/* =====================================================================
   NK Asset — Design system
   โทนน้ำเงิน gradient · ขาว  |  motion นุ่มนวล  |  full responsive
   ===================================================================== */

:root {
  --b-950: #061a44;
  --b-900: #0a2a6e;
  --b-800: #0b3a8c;
  --b-700: #1449b8;
  --b-600: #1e5eea;
  --b-500: #2f7bff;
  --b-400: #5e9bff;
  --b-300: #9cc2ff;
  --b-200: #c9dcff;
  --b-100: #e5eeff;
  --b-50:  #f3f7ff;

  --grad: linear-gradient(135deg, #0b3a8c 0%, #1e5eea 52%, #3d9dff 100%);
  --grad-soft: linear-gradient(135deg, #eef4ff 0%, #f8fbff 100%);

  --bg: #f4f7fd;
  --surface: #ffffff;
  --surface-2: #f8faff;
  --text: #0e1d3d;
  --text-2: #3b4d70;
  --muted: #6a7a99;
  --line: #e3e9f5;
  --line-2: #eef2fa;

  --ok: #16a34a;   --ok-bg: #e7f8ed;
  --bad: #dc2626;  --bad-bg: #fdecec;
  --warn: #d97706; --warn-bg: #fdf3e2;
  --gray: #64748b; --gray-bg: #f0f3f8;

  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sh-1: 0 1px 2px rgba(15, 40, 100, .06), 0 1px 1px rgba(15, 40, 100, .04);
  --sh-2: 0 6px 18px -6px rgba(20, 60, 160, .16), 0 2px 6px -2px rgba(20, 60, 160, .08);
  --sh-3: 0 24px 48px -16px rgba(16, 52, 150, .28), 0 8px 16px -8px rgba(16, 52, 150, .12);
  --ring: 0 0 0 4px rgba(47, 123, 255, .18);

  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: 160ms;
  --t: 280ms;
  --t-slow: 480ms;

  --side-w: 264px;
  --top-h: 68px;

  --font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, sans-serif;
  --font-display: "Prompt", "IBM Plex Sans Thai", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(61, 157, 255, .10), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(30, 94, 234, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[x-cloak] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--b-600); text-decoration: none; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: .92em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
::selection { background: var(--b-200); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: #c7d4ee transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #c7d4ee; border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }

/* =====================================================================
   Boot splash
   ===================================================================== */
.splash {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center;
  background: var(--grad); color: #fff;
  transition: opacity .5s var(--ease), visibility .5s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-logo { width: 72px; height: 72px; border-radius: 22px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.3); backdrop-filter: blur(8px);
  animation: pulse-soft 1.6s var(--ease) infinite; font-size: 30px; }
@keyframes pulse-soft { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255,255,255,.35);} 50% { transform: scale(1.05); box-shadow: 0 0 0 18px rgba(255,255,255,0);} }

/* =====================================================================
   Login
   ===================================================================== */
.login {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.login-hero {
  position: relative; overflow: hidden; color: #fff;
  background: var(--grad);
  padding: 56px clamp(32px, 6vw, 88px);
  display: flex; flex-direction: column; justify-content: space-between;
}
.mesh { position: absolute; inset: -20%; pointer-events: none; filter: blur(60px); opacity: .7; }
.mesh span { position: absolute; border-radius: 50%; animation: drift 18s ease-in-out infinite alternate; }
.mesh span:nth-child(1) { width: 520px; height: 520px; background: #3d9dff; left: 50%; top: 5%; }
.mesh span:nth-child(2) { width: 460px; height: 460px; background: #0a2a6e; left: 0; top: 50%; animation-duration: 22s; }
.mesh span:nth-child(3) { width: 360px; height: 360px; background: #7fb6ff; left: 65%; top: 60%; animation-duration: 26s; opacity: .7; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(-60px, 40px) scale(1.15); } }
.grid-lines {
  position: absolute; inset: 0; pointer-events: none; opacity: .14;
  background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 70%);
}
.brand { display: flex; align-items: center; gap: 12px; position: relative; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 20px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.32); backdrop-filter: blur(6px);
}
.brand b { font-family: var(--font-display); font-weight: 600; font-size: 19px; letter-spacing: .2px; display: block; line-height: 1.2; }
.brand small { opacity: .8; font-size: 13px; }
.hero-copy { position: relative; max-width: 520px; }
.hero-copy h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(30px, 3.4vw, 46px); line-height: 1.18; margin: 0 0 16px; }
.hero-copy h1 em { font-style: normal; background: linear-gradient(90deg,#fff,#bfe0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { opacity: .85; font-size: 16px; margin: 0; max-width: 440px; }
.hero-cards { position: relative; height: 210px; margin-top: 28px; }
.float-card {
  position: absolute; padding: 14px 16px; border-radius: 16px; min-width: 190px;
  background: rgba(255,255,255,.13); border: 1px solid rgba(255,255,255,.28);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 40px -20px rgba(0,10,50,.5);
  animation: floaty 7s ease-in-out infinite;
}
.float-card small { opacity: .8; font-size: 12.5px; }
.float-card b { display: block; font-family: var(--font-display); font-size: 22px; font-weight: 600; }
.float-card .bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.2); margin-top: 8px; overflow: hidden; }
.float-card .bar i { display: block; height: 100%; width: 68%; background: #fff; border-radius: inherit; }
.float-card:nth-child(1) { left: 0; top: 10px; }
.float-card:nth-child(2) { left: 210px; top: 70px; animation-delay: -2.4s; }
.float-card:nth-child(3) { left: 40px; top: 128px; animation-delay: -4.6s; }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.hero-foot { position: relative; font-size: 13px; opacity: .7; }

.login-panel { display: grid; place-items: center; padding: 40px 24px; background: #fff; }
.login-box { width: min(400px, 100%); }
.login-box h2 { font-family: var(--font-display); font-weight: 600; font-size: 28px; margin: 0 0 6px; }
.login-box > p { color: var(--muted); margin: 0 0 30px; }
.login-box .btn-primary { width: 100%; height: 52px; font-size: 16px; margin-top: 8px; }
.login-note { margin-top: 26px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 28px 22px 34px; min-height: auto; }
  .hero-cards, .hero-foot { display: none; }
  .hero-copy { margin-top: 28px; }
  .hero-copy h1 { font-size: 27px; }
  .hero-copy p { font-size: 14.5px; }
  .login-panel { margin-top: -22px; border-radius: 24px 24px 0 0; position: relative; padding-top: 34px; align-items: start; }
}

/* =====================================================================
   Form controls
   ===================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; position: relative; }
.field label, .label { font-size: 13.5px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field label .req { color: var(--bad); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .err { font-size: 12.5px; color: var(--bad); display: flex; align-items: center; gap: 5px; animation: shake .35s var(--ease); }
@keyframes shake { 0%,100% { transform: translateX(0);} 25% { transform: translateX(-4px);} 75% { transform: translateX(4px);} }

.input, .select, .textarea {
  width: 100%; height: 46px; padding: 0 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  outline: none; font-size: 15px;
}
.textarea { height: auto; min-height: 84px; padding: 12px 14px; resize: vertical; }
.select {
  appearance: none; padding-right: 40px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%236a7a99' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 15px center;
}
.input:hover, .select:hover, .textarea:hover { border-color: #cfdaee; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--b-500); box-shadow: var(--ring); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--bad); background: #fffafa; }
.input.invalid:focus { box-shadow: 0 0 0 4px rgba(220,38,38,.14); }
.input::placeholder, .textarea::placeholder { color: #a3afc6; }
.input-icon { position: relative; }
.input-icon > i:first-child { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; transition: color var(--t-fast); }
.input-icon .input { padding-left: 42px; }
.input-icon:focus-within > i:first-child { color: var(--b-600); }
.input-suffix { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 4px; }
.input-suffix .unit { font-size: 13px; color: var(--muted); padding-right: 6px; }
.icon-btn-plain { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 9px; color: var(--muted); display: grid; place-items: center; }
.icon-btn-plain:hover { background: var(--b-50); color: var(--b-700); }
.code-status { font-size: 12.5px; display: flex; align-items: center; gap: 5px; }
.code-status.ok { color: var(--ok); }
.code-status.bad { color: var(--bad); }

/* segmented control */
.segment { display: inline-flex; padding: 4px; border-radius: 12px; background: var(--b-50); border: 1px solid var(--line); gap: 2px; flex-wrap: wrap; }
.segment button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-size: 14px; color: var(--text-2); transition: all var(--t-fast) var(--ease); display: inline-flex; align-items: center; gap: 7px; }
.segment button:hover { color: var(--b-700); }
.segment button.on { background: #fff; color: var(--b-700); box-shadow: var(--sh-1); font-weight: 500; }
.segment .dot { width: 8px; height: 8px; border-radius: 50%; }

/* switch */
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cfd8ea; transition: background var(--t) var(--ease); cursor: pointer; }
.switch span::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.15); transition: transform var(--t) var(--ease-spring); }
.switch input:checked + span { background: var(--b-600); }
.switch input:checked + span::after { transform: translateX(18px); }

.check { width: 19px; height: 19px; border-radius: 6px; accent-color: var(--b-600); cursor: pointer; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  --h: 42px;
  height: var(--h); padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 500; font-size: 14.5px; white-space: nowrap; user-select: none;
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t) var(--ease), background var(--t-fast), border-color var(--t-fast), color var(--t-fast), opacity var(--t-fast);
  position: relative; overflow: hidden; isolation: isolate;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { --h: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }
.btn-lg { --h: 50px; padding: 0 24px; font-size: 15.5px; }
.btn-primary { color: #fff; background: var(--grad); background-size: 140% 140%; box-shadow: 0 8px 20px -8px rgba(30, 94, 234, .65); }
.btn-primary:hover:not(:disabled) { background-position: 100% 50%; box-shadow: 0 12px 28px -10px rgba(30, 94, 234, .75); transform: translateY(-1px); }
.btn-primary::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(115deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-120%); transition: transform .8s var(--ease); }
.btn-primary:hover::after { transform: translateX(120%); }
.btn-soft { background: var(--b-50); color: var(--b-700); border-color: var(--b-100); }
.btn-soft:hover:not(:disabled) { background: var(--b-100); }
.btn-ghost { background: #fff; color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: var(--b-300); color: var(--b-700); background: var(--b-50); }
.btn-danger { background: var(--bad); color: #fff; box-shadow: 0 8px 18px -8px rgba(220, 38, 38, .6); }
.btn-danger:hover:not(:disabled) { background: #c81e1e; }
.btn-danger-soft { background: var(--bad-bg); color: var(--bad); }
.btn-danger-soft:hover:not(:disabled) { background: #fbd5d5; }
.btn-white { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); backdrop-filter: blur(6px); }
.btn-white:hover:not(:disabled) { background: rgba(255,255,255,.26); }
.btn .spin { width: 18px; height: 18px; border: 2.4px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.icon-btn { width: 40px; height: 40px; padding: 0; border-radius: 12px; }
.icon-btn.btn-sm { width: 34px; height: 34px; }

/* =====================================================================
   App shell
   ===================================================================== */
.shell { display: grid; grid-template-columns: var(--side-w) 1fr; min-height: 100dvh; transition: grid-template-columns var(--t-slow) var(--ease); }
.shell.collapsed { --side-w: 84px; }

.sidebar {
  position: sticky; top: 0; height: 100dvh; z-index: 40;
  background: var(--grad); color: #fff;
  display: flex; flex-direction: column; padding: 20px 14px;
  overflow: hidden;
}
.sidebar::before { content: ""; position: absolute; width: 380px; height: 380px; right: -180px; top: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%); pointer-events: none; }
.sidebar::after { content: ""; position: absolute; width: 300px; height: 300px; left: -150px; bottom: -80px; border-radius: 50%; background: radial-gradient(circle, rgba(10, 42, 110, .55), transparent 70%); pointer-events: none; }
.side-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; position: relative; white-space: nowrap; }
.side-brand .brand-mark { flex: none; }
.side-label { transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); }
.collapsed .side-label { opacity: 0; transform: translateX(-8px); pointer-events: none; }
.nav { display: flex; flex-direction: column; gap: 4px; position: relative; flex: 1; }
.nav-title { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; opacity: .6; padding: 14px 14px 6px; white-space: nowrap; }
.nav a {
  display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 14px; border-radius: 13px;
  color: rgba(255,255,255,.82); white-space: nowrap; position: relative;
  transition: background var(--t) var(--ease), color var(--t-fast);
}
.nav a i { width: 22px; text-align: center; font-size: 17px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.on { background: rgba(255,255,255,.95); color: var(--b-800); font-weight: 600; box-shadow: 0 10px 24px -12px rgba(0, 12, 60, .55); }
.nav a .badge { margin-left: auto; font-size: 11.5px; padding: 1px 8px; border-radius: 99px; background: rgba(255,255,255,.2); }
.nav a.on .badge { background: var(--b-100); color: var(--b-700); }
.side-foot { position: relative; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.14); }
.side-user { display: flex; align-items: center; gap: 11px; padding: 10px 8px; border-radius: 14px; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; font-weight: 600; font-family: var(--font-display); background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); }
.avatar.light { background: var(--grad); color: #fff; border: 0; }
.side-user b { display: block; font-size: 14px; font-weight: 500; line-height: 1.25; }
.side-user small { opacity: .7; font-size: 12px; }
.collapse-btn { margin-top: 8px; width: 100%; height: 38px; border-radius: 11px; border: 1px solid rgba(255,255,255,.18); background: transparent; color: rgba(255,255,255,.8); display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; }
.collapse-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.collapsed .collapse-btn i { transform: rotate(180deg); }
.collapse-btn i { transition: transform var(--t) var(--ease); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--top-h);
  display: flex; align-items: center; gap: 14px; padding: 0 clamp(16px, 3vw, 32px);
  background: rgba(244, 247, 253, .78); backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent; transition: border-color var(--t), box-shadow var(--t);
}
.topbar.scrolled { border-bottom-color: var(--line); box-shadow: 0 8px 20px -18px rgba(20, 50, 120, .5); }
.topbar h1 { font-family: var(--font-display); font-weight: 600; font-size: 20px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb { font-size: 12.5px; color: var(--muted); display: block; line-height: 1.1; }
.top-search {
  margin-left: auto; width: min(380px, 34vw); height: 42px; border-radius: 12px; border: 1.5px solid var(--line); background: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 12px; color: var(--muted); font-size: 14px; transition: all var(--t-fast);
}
.top-search:hover { border-color: var(--b-300); color: var(--text-2); }
.kbd { margin-left: auto; font-size: 11.5px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-family: inherit; }
.menu-btn { display: none; }
.content { padding: 8px clamp(16px, 3vw, 32px) 40px; flex: 1; }

/* page enter animation */
.page { animation: page-in var(--t-slow) var(--ease) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.stagger > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }

/* =====================================================================
   Cards & dashboard
   ===================================================================== */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-1); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.card-head h3 .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--b-50); color: var(--b-600); font-size: 14px; }
.card-head .sub { font-size: 13px; color: var(--muted); }
.hover-lift { transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease), border-color var(--t); }
.hover-lift:hover { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: var(--b-200); }

.hero-banner {
  position: relative; overflow: hidden; border-radius: var(--r-xl); color: #fff; background: var(--grad);
  padding: clamp(22px, 3vw, 32px); display: grid; grid-template-columns: 1.4fr 1fr; gap: 24px; align-items: end;
  box-shadow: var(--sh-3);
}
.hero-banner .mesh { opacity: .55; filter: blur(50px); }
.hero-banner .grid-lines { opacity: .1; }
.hero-banner > * { position: relative; }
.hello { font-size: 14.5px; opacity: .85; display: flex; align-items: center; gap: 8px; }
.hero-value { font-family: var(--font-display); font-weight: 600; font-size: clamp(32px, 4.4vw, 50px); line-height: 1.1; margin: 8px 0 4px; letter-spacing: -.5px; }
.hero-value small { font-size: .45em; font-weight: 500; opacity: .8; margin-left: 6px; }
.hero-sub { opacity: .82; font-size: 14px; }
.hero-meter { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.22); border-radius: 18px; padding: 16px 18px; backdrop-filter: blur(10px); }
.hero-meter .row { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 8px; opacity: .9; }
.meter { height: 10px; border-radius: 10px; background: rgba(255,255,255,.2); overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; transition: width 1.2s var(--ease); }
.meter i:first-child { background: #fff; border-radius: 10px 0 0 10px; }
.meter i:last-child { background: rgba(255,255,255,.35); }
.hero-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.kpi { padding: 18px 18px 16px; position: relative; overflow: hidden; cursor: pointer; }
.kpi .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-size: 18px; margin-bottom: 14px; }
.kpi .label { font-size: 13.5px; color: var(--muted); font-weight: 400; }
.kpi .val { font-family: var(--font-display); font-size: 28px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.kpi .foot { font-size: 12.5px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.kpi::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: currentColor; opacity: .05; transition: transform var(--t-slow) var(--ease); }
.kpi:hover::after { transform: scale(1.4); }
.tone-blue  { color: var(--b-600); } .tone-blue .ico  { background: var(--b-50); color: var(--b-600); }
.tone-green { color: var(--ok); }    .tone-green .ico { background: var(--ok-bg); color: var(--ok); }
.tone-red   { color: var(--bad); }   .tone-red .ico   { background: var(--bad-bg); color: var(--bad); }
.tone-amber { color: var(--warn); }  .tone-amber .ico { background: var(--warn-bg); color: var(--warn); }
.kpi .val, .kpi .label { color: var(--text); }
.kpi .label { color: var(--muted); }

.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-12 { grid-column: span 12; }
.chart-box { position: relative; height: 290px; padding: 12px 18px 18px; }
.chart-box.sm { height: 240px; }

.rank-list { padding: 8px 12px 14px; }
.rank { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 10px 10px; border-radius: 12px; cursor: pointer; transition: background var(--t-fast); }
.rank:hover { background: var(--b-50); }
.rank .name { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .n { font-size: 13px; color: var(--muted); }
.rank .track { grid-column: 1 / -1; height: 6px; border-radius: 6px; background: var(--line-2); overflow: hidden; }
.rank .track i { display: block; height: 100%; border-radius: inherit; background: var(--grad); transition: width 1s var(--ease); }

.alert-list { padding: 6px 12px 14px; }
.alert-item { display: flex; gap: 12px; align-items: center; padding: 11px 10px; border-radius: 12px; cursor: pointer; transition: background var(--t-fast); }
.alert-item:hover { background: var(--surface-2); }
.alert-item .ring { flex: none; }
.alert-item .t { min-width: 0; flex: 1; }
.alert-item .t b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-item .t small { color: var(--muted); font-size: 12.5px; }

.timeline { list-style: none; margin: 0; padding: 12px 22px 18px; }
.timeline li { position: relative; padding: 0 0 16px 30px; }
.timeline li::before { content: ""; position: absolute; left: 8px; top: 22px; bottom: 0; width: 2px; background: var(--line-2); }
.timeline li:last-child::before { display: none; }
.timeline .dot { position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; color: #fff; box-shadow: 0 0 0 4px #fff; }
.timeline .dot.create { background: var(--ok); }
.timeline .dot.update { background: var(--b-500); }
.timeline .dot.delete { background: var(--bad); }
.timeline .dot.other  { background: var(--gray); }
.timeline .who { font-size: 14px; }
.timeline .who b { font-weight: 600; }
.timeline .when { font-size: 12.5px; color: var(--muted); }
.diff { margin-top: 8px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; font-size: 13px; }
.diff div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; padding: 7px 12px; border-top: 1px solid var(--line-2); }
.diff div:first-child { border-top: 0; }
.diff span:first-child { color: var(--muted); }
.diff del { color: var(--bad); background: var(--bad-bg); text-decoration: line-through; padding: 0 5px; border-radius: 5px; margin-right: 6px; }
.diff ins { color: var(--ok); background: var(--ok-bg); text-decoration: none; padding: 0 5px; border-radius: 5px; }

/* progress ring */
.ring { --p: 0; --c: var(--b-600); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line-2) 0); position: relative; font-size: 11px; font-weight: 600; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.ring span { position: relative; }
.ring.lg { width: 120px; height: 120px; font-size: 22px; font-family: var(--font-display); }
.ring.lg::before { inset: 11px; }

/* =====================================================================
   Assets view
   ===================================================================== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .search { flex: 1 1 320px; }
.toolbar .search .input { height: 46px; background: #fff; }
.filter-btn .count { min-width: 20px; height: 20px; border-radius: 99px; background: var(--b-600); color: #fff; font-size: 11.5px; display: grid; place-items: center; padding: 0 6px; }

.quick-chips { display: flex; gap: 8px; margin-top: 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.quick-chips::-webkit-scrollbar { display: none; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 99px; border: 1.5px solid var(--line); background: #fff;
  font-size: 13.5px; color: var(--text-2); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  transition: all var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--b-300); color: var(--b-700); }
.chip.on { background: var(--b-700); border-color: var(--b-700); color: #fff; box-shadow: 0 6px 14px -8px rgba(20, 73, 184, .8); }
.chip .c { font-size: 12px; opacity: .7; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; }

.filter-panel { margin-top: 14px; padding: 18px 20px 4px; overflow: hidden; }
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0 16px; }
.range { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.range > span { color: var(--muted); }

.active-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 6px 0 12px; border-radius: 99px; background: var(--b-50); color: var(--b-700); border: 1px solid var(--b-100); font-size: 13px; animation: pop .3s var(--ease-spring); }
.tag button { border: 0; background: transparent; width: 22px; height: 22px; border-radius: 50%; color: inherit; display: grid; place-items: center; font-size: 11px; }
.tag button:hover { background: var(--b-200); }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.summary-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 16px; overflow: hidden; }
.summary-strip > div { padding: 14px 20px; display: flex; align-items: center; gap: 14px; }
.summary-strip > div + div { border-left: 1px solid var(--line-2); }
.summary-strip .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--b-50); color: var(--b-600); flex: none; }
.summary-strip small { color: var(--muted); font-size: 12.5px; display: block; }
.summary-strip b { font-family: var(--font-display); font-weight: 600; font-size: 19px; }

.table-card { margin-top: 16px; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.grid th {
  position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 500; font-size: 13px; color: var(--muted);
  padding: 13px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid th.sortable { cursor: pointer; user-select: none; transition: color var(--t-fast); }
.grid th.sortable:hover { color: var(--b-700); }
.grid th.sorted { color: var(--b-700); }
.grid th .s-ico { margin-left: 6px; font-size: 11px; opacity: .35; transition: transform var(--t) var(--ease), opacity var(--t-fast); }
.grid th.sorted .s-ico { opacity: 1; }
.grid th.sorted.desc .s-ico { transform: rotate(180deg); }
.grid td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; background: #fff; transition: background var(--t-fast); }
.grid tbody tr { cursor: pointer; animation: row-in .45s var(--ease) both; animation-delay: calc(var(--i, 0) * 22ms); }
@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.grid tbody tr:hover td { background: #f6f9ff; }
.grid tbody tr.selected td { background: #edf3ff; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid .t-right { text-align: right; }
.grid .t-center { text-align: center; }
.cell-title { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.thumb { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; font-size: 16px; color: #fff; }
.cell-title b { font-weight: 500; display: block; line-height: 1.35; }
.cell-title small { color: var(--muted); font-size: 12.5px; }
.code-pill { display: inline-block; padding: 3px 9px; border-radius: 8px; background: var(--b-50); color: var(--b-800); font-size: 12.5px; white-space: nowrap; border: 1px solid var(--b-100); }
.value-cell b { font-weight: 600; display: block; }
.mini-bar { width: 96px; height: 5px; border-radius: 5px; background: var(--line-2); margin-top: 5px; margin-left: auto; overflow: hidden; }
.mini-bar i { display: block; height: 100%; border-radius: inherit; background: var(--grad); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .55; transition: opacity var(--t-fast); }
tr:hover .row-actions { opacity: 1; }

.status { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px 0 9px; border-radius: 99px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-ok   { background: var(--ok-bg);   color: var(--ok); }
.st-bad  { background: var(--bad-bg);  color: var(--bad); }
.st-warn { background: var(--warn-bg); color: var(--warn); }
.st-gray { background: var(--gray-bg); color: var(--gray); }
.st-ok::before { animation: blink 2.4s ease-in-out infinite; }
@keyframes blink { 0%,100% { box-shadow: 0 0 0 0 rgba(22,163,74,.45);} 50% { box-shadow: 0 0 0 4px rgba(22,163,74,0);} }

/* grid of cards (mobile & grid view) */
.asset-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; margin-top: 16px; }
.a-card { padding: 16px; cursor: pointer; position: relative; animation: rise .5s var(--ease) both; animation-delay: calc(var(--i, 0) * 30ms); }
.a-card .top { display: flex; gap: 12px; align-items: flex-start; }
.a-card .top > div { min-width: 0; flex: 1; }
.a-card h4 { margin: 4px 0 2px; font-size: 15px; font-weight: 600; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.a-card .meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.a-card .bottom { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.a-card .bottom small { color: var(--muted); font-size: 12px; display: block; }
.a-card .bottom b { font-family: var(--font-display); font-weight: 600; font-size: 17px; }
.a-card .sel { position: absolute; top: 14px; right: 14px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-top: 1px solid var(--line-2); flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.pager .pages { display: flex; gap: 4px; }
.pager .pages button { min-width: 36px; height: 36px; padding: 0 8px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: var(--text-2); transition: all var(--t-fast); }
.pager .pages button:hover:not(:disabled) { background: var(--b-50); color: var(--b-700); }
.pager .pages button.on { background: var(--b-700); color: #fff; box-shadow: 0 6px 14px -8px rgba(20,73,184,.8); }
.pager .pages button:disabled { opacity: .35; cursor: default; }
.pager .select { height: 36px; width: auto; padding-right: 34px; font-size: 13.5px; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .art { width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 36px; display: grid; place-items: center; font-size: 46px; color: var(--b-500); background: var(--grad-soft); border: 1px solid var(--b-100); animation: floaty 5s ease-in-out infinite; }
.empty h4 { color: var(--text); font-size: 17px; margin: 0 0 6px; font-weight: 600; }

/* skeleton */
.sk { position: relative; overflow: hidden; background: #edf1f8; border-radius: 8px; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* bulk bar */
.bulk-bar {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 18px;
  background: var(--b-950); color: #fff; box-shadow: 0 24px 50px -16px rgba(6, 26, 68, .7);
  max-width: calc(100vw - 24px); overflow-x: auto;
}
.bulk-bar .n { font-weight: 600; white-space: nowrap; margin-right: 6px; }
.bulk-bar .btn { --h: 38px; }
.bulk-bar .btn-ghost { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.14); }
.bulk-bar .btn-ghost:hover { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.25); }

/* =====================================================================
   Drawer (asset detail)
   ===================================================================== */
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(8, 22, 58, .38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 90; width: min(640px, 100vw);
  background: var(--bg); box-shadow: -30px 0 60px -30px rgba(10, 30, 90, .45);
  display: flex; flex-direction: column;
}
.drawer-head { position: relative; overflow: hidden; color: #fff; background: var(--grad); padding: 20px 22px 0; flex: none; }
.drawer-head .mesh { opacity: .45; filter: blur(40px); }
.drawer-head > * { position: relative; }
.drawer-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawer-title { margin: 16px 0 4px; font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.3; }
.drawer-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; font-size: 13.5px; opacity: .9; }
.drawer-sub .code-pill { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.28); }
.drawer .status { background: #fff; }
.tabs { display: flex; gap: 4px; margin-top: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; color: rgba(255,255,255,.75); padding: 11px 14px 13px; font-size: 14px; position: relative; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: color var(--t-fast); }
.tabs button:hover { color: #fff; }
.tabs button.on { color: #fff; font-weight: 500; }
.tabs button.on::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: #fff; animation: grow .35s var(--ease); }
@keyframes grow { from { transform: scaleX(.2); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; }
.drawer-foot { flex: none; display: flex; gap: 10px; padding: 14px 20px; background: #fff; border-top: 1px solid var(--line); }
.drawer-foot .grow { flex: 1; }

.value-card { display: grid; grid-template-columns: auto 1fr; gap: 20px; align-items: center; padding: 18px 20px; }
.value-card .lines { display: grid; gap: 10px; }
.value-card .line { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.value-card .line span { color: var(--muted); }
.value-card .line b { font-weight: 600; }
.value-card .line.big b { font-family: var(--font-display); font-size: 22px; color: var(--b-700); }

.info-sec { margin-top: 14px; }
.info-sec h5 { margin: 0; padding: 14px 18px 10px; font-size: 13.5px; color: var(--b-700); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; }
.info-grid > div { padding: 10px 18px 12px; border-top: 1px solid var(--line-2); min-width: 0; }
.info-grid > div:nth-child(odd) { border-right: 1px solid var(--line-2); }
.info-grid > div.full { grid-column: 1 / -1; border-right: 0; }
.info-grid small { display: block; color: var(--muted); font-size: 12.5px; }
.info-grid span { font-size: 14.5px; word-break: break-word; white-space: pre-line; }
.info-grid .empty-v { color: #b4bfd3; }

.sched { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sched th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12.5px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.sched th:first-child, .sched td:first-child { text-align: left; }
.sched td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line-2); }
.sched tr.past td { color: var(--muted); }
.sched tr.current td { background: var(--b-50); font-weight: 600; color: var(--b-800); }
.sched tr.current td:first-child { box-shadow: inset 3px 0 0 var(--b-600); }

.qr-box { display: grid; place-items: center; padding: 26px; text-align: center; }
.qr-frame { padding: 16px; border-radius: 22px; background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-2); }
.qr-frame svg, .qr-frame img { display: block; width: 210px; height: 210px; }

/* =====================================================================
   Modal
   ===================================================================== */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; overflow-y: auto; }
.modal {
  width: min(560px, 100%); background: #fff; border-radius: 24px; box-shadow: var(--sh-3);
  position: relative; max-height: calc(100dvh - 40px); display: flex; flex-direction: column; overflow: hidden;
}
.modal.xl { width: min(1080px, 100%); }
.modal.sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line-2); flex: none; }
.modal-head .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--grad); color: #fff; font-size: 18px; flex: none; box-shadow: 0 8px 18px -8px rgba(30, 94, 234, .7); }
.modal-head h3 { margin: 0; font-size: 18px; font-weight: 600; font-family: var(--font-display); }
.modal-head p { margin: 0; font-size: 13px; color: var(--muted); }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 22px 24px; overflow-y: auto; flex: 1; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 16px 24px; border-top: 1px solid var(--line-2); background: var(--surface-2); flex: none; }

/* asset form layout */
.form-layout { display: grid; grid-template-columns: 200px 1fr 300px; min-height: 0; flex: 1; overflow: hidden; }
.form-steps { padding: 22px 14px; border-right: 1px solid var(--line-2); background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; }
.form-steps button { border: 0; background: transparent; text-align: left; padding: 11px 12px; border-radius: 12px; display: flex; gap: 12px; align-items: center; color: var(--text-2); font-size: 14px; transition: all var(--t-fast); }
.form-steps button .n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; background: #fff; border: 1.5px solid var(--line); flex: none; transition: all var(--t) var(--ease); }
.form-steps button:hover { background: #fff; }
.form-steps button.on { background: #fff; color: var(--b-700); font-weight: 500; box-shadow: var(--sh-1); }
.form-steps button.on .n { background: var(--grad); color: #fff; border-color: transparent; }
.form-steps button.has-err .n { border-color: var(--bad); color: var(--bad); background: var(--bad-bg); }
.form-main { overflow-y: auto; padding: 22px 26px; scroll-behavior: smooth; }
.form-sec { padding-bottom: 8px; margin-bottom: 18px; scroll-margin-top: 10px; }
.form-sec + .form-sec { border-top: 1px dashed var(--line); padding-top: 22px; }
.form-sec h4 { margin: 0 0 16px; font-size: 15.5px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.form-sec h4 i { color: var(--b-600); }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.fgrid .full { grid-column: 1 / -1; }
.form-preview { border-left: 1px solid var(--line-2); padding: 22px 20px; background: linear-gradient(180deg, var(--b-50), #fff 60%); overflow-y: auto; }
.preview-card { border-radius: 18px; padding: 18px; color: #fff; background: var(--grad); position: relative; overflow: hidden; box-shadow: var(--sh-2); }
.preview-card::after { content: ""; position: absolute; right: -50px; top: -50px; width: 160px; height: 160px; border-radius: 50%; background: rgba(255,255,255,.12); }
.preview-card small { opacity: .8; font-size: 12.5px; }
.preview-card .big { font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.2; margin: 2px 0 12px; }
.preview-card .meter { margin-top: 6px; }
.preview-lines { margin-top: 14px; display: grid; gap: 2px; }
.preview-lines div { display: flex; justify-content: space-between; padding: 9px 4px; border-bottom: 1px dashed var(--line); font-size: 13.5px; }
.preview-lines span { color: var(--muted); }
.preview-tip { margin-top: 16px; font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; line-height: 1.5; }

/* =====================================================================
   Settings / users / logs
   ===================================================================== */
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-2); transition: background var(--t-fast); }
.list-row:hover { background: var(--surface-2); }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow b { font-weight: 500; display: block; }
.list-row .grow small { color: var(--muted); font-size: 12.5px; }
.list-row .acts { display: flex; gap: 4px; opacity: .5; transition: opacity var(--t-fast); }
.list-row:hover .acts { opacity: 1; }
.inline-add { display: flex; gap: 8px; padding: 14px 18px; }
.inline-add .input { height: 42px; }
.role-pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; font-weight: 500; }
.role-admin { background: var(--b-100); color: var(--b-800); }
.role-viewer { background: var(--gray-bg); color: var(--gray); }

/* =====================================================================
   Toasts / confirm / palette
   ===================================================================== */
.toasts { position: fixed; z-index: 300; top: 18px; right: 18px; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px;
  background: #fff; border: 1px solid var(--line); box-shadow: var(--sh-3); position: relative; overflow: hidden;
}
.toast .ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.toast b { display: block; font-weight: 600; font-size: 14.5px; }
.toast p { margin: 2px 0 0; font-size: 13.5px; color: var(--muted); }
.toast .life { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .5; animation: life linear forwards; }
@keyframes life { from { width: 100%; } to { width: 0; } }
.toast.success { color: var(--ok); } .toast.success .ico { background: var(--ok-bg); }
.toast.error { color: var(--bad); } .toast.error .ico { background: var(--bad-bg); }
.toast.info { color: var(--b-600); } .toast.info .ico { background: var(--b-50); }
.toast > div { color: var(--text); }

.confirm-ico { width: 64px; height: 64px; border-radius: 22px; margin: 6px auto 16px; display: grid; place-items: center; font-size: 26px; }
.confirm-ico.danger { background: var(--bad-bg); color: var(--bad); animation: wiggle .6s var(--ease) .1s; }
.confirm-ico.info { background: var(--b-50); color: var(--b-600); }
@keyframes wiggle { 0%,100% { transform: rotate(0);} 25% { transform: rotate(-8deg);} 50% { transform: rotate(6deg);} 75% { transform: rotate(-3deg);} }

.palette { width: min(640px, 100%); align-self: start; margin-top: 10vh; }
.palette .p-input { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.palette .p-input input { flex: 1; border: 0; outline: none; font-size: 17px; background: transparent; }
.palette .p-list { max-height: 56vh; overflow-y: auto; padding: 8px; }
.palette .p-group { font-size: 12px; color: var(--muted); padding: 10px 12px 6px; text-transform: uppercase; letter-spacing: .06em; }
.palette .p-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; cursor: pointer; }
.palette .p-item.on { background: var(--b-50); }
.palette .p-item .thumb { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
.palette .p-item .grow { flex: 1; min-width: 0; }
.palette .p-item b { font-weight: 500; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette .p-item small { color: var(--muted); }

/* =====================================================================
   Transitions (Alpine x-transition helpers)
   ===================================================================== */
.fade-enter { transition: opacity var(--t) var(--ease); }
.fade-leave { transition: opacity 200ms ease; }
.fade-from, .fade-to-leave { opacity: 0; }
.drawer-enter { transition: transform var(--t-slow) var(--ease); }
.drawer-leave { transition: transform var(--t) cubic-bezier(.4, 0, 1, 1); }
.drawer-from { transform: translateX(100%); }
.pop-enter { transition: opacity var(--t) var(--ease), transform var(--t-slow) var(--ease-spring); }
.pop-leave { transition: opacity 180ms ease, transform 200ms ease; }
.pop-from { opacity: 0; transform: translateY(18px) scale(.96); }
.toast-enter { transition: transform .5s var(--ease-spring), opacity .3s; }
.toast-leave { transition: transform .3s var(--ease), opacity .25s; }
.toast-from { transform: translateX(110%); opacity: 0; }
.slide-enter { transition: opacity var(--t) var(--ease), transform var(--t) var(--ease); }
.slide-leave { transition: opacity 150ms ease, transform 150ms ease; }
.slide-from { opacity: 0; transform: translateY(-8px); }
.up-enter { transition: transform .45s var(--ease-spring), opacity .25s; }
.up-leave { transition: transform .25s ease, opacity .2s; }
.up-from { transform: translate(-50%, 120%) !important; opacity: 0; }

/* dropdown */
.dropdown { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--sh-3); padding: 6px; }
.menu.up { top: auto; bottom: calc(100% + 8px); }
.menu button, .menu a { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; font-size: 14px; color: var(--text-2); text-align: left; }
.menu button:hover, .menu a:hover { background: var(--b-50); color: var(--b-700); }
.menu button.danger { color: var(--bad); }
.menu button.danger:hover { background: var(--bad-bg); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 6px 4px; }
.menu i { width: 18px; text-align: center; }

/* =====================================================================
   Mobile
   ===================================================================== */
.bottom-nav { display: none; }
.fab { display: none; }

@media (max-width: 1280px) {
  .form-layout { grid-template-columns: 1fr 280px; }
  .form-steps { display: none; }
}
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-8, .span-7, .span-6, .span-5, .span-4 { grid-column: span 12; }
  .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  .shell, .shell.collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-105%); transition: transform var(--t-slow) var(--ease); box-shadow: 30px 0 60px -30px rgba(6, 26, 68, .6); }
  .sidebar.open { transform: none; }
  .collapse-btn { display: none; }
  .menu-btn { display: inline-flex; }
  .collapsed .side-label { opacity: 1; transform: none; pointer-events: auto; }
}
@media (max-width: 760px) {
  body { font-size: 14.5px; }
  :root { --top-h: 60px; }
  .topbar h1 { font-size: 18px; }
  .top-search { width: 42px; padding: 0; justify-content: center; margin-left: auto; }
  .top-search span, .top-search .kbd { display: none; }
  .content { padding: 4px 14px 110px; }
  .hero-banner { grid-template-columns: 1fr; border-radius: 22px; }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .ico { width: 38px; height: 38px; font-size: 16px; margin-bottom: 10px; }
  .kpi .val { font-size: 22px; }
  .chart-box { height: 240px; padding: 8px 10px 14px; }
  .filter-grid { grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-strip > div:first-child { grid-column: 1 / -1; border-bottom: 1px solid var(--line-2); }
  .summary-strip > div:nth-child(2) { border-left: 0; }
  .summary-strip > div { padding: 12px 14px; gap: 10px; }
  .summary-strip .ico { display: none; }
  .summary-strip b { font-size: 16px; }
  .toolbar .hide-sm { display: none; }
  .toolbar .search { flex-basis: 100%; }
  .asset-cards { grid-template-columns: 1fr; gap: 10px; }
  .pager { justify-content: center; }
  .pager .per { display: none; }
  .modal-wrap { padding: 0; place-items: end center; }
  .modal, .modal.xl, .modal.sm { width: 100%; max-height: 94dvh; border-radius: 24px 24px 0 0; }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .form-layout { grid-template-columns: 1fr; overflow-y: auto; }
  .form-main { overflow: visible; padding: 18px; }
  .form-preview { border-left: 0; border-top: 1px solid var(--line-2); padding: 18px; }
  .fgrid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .info-grid > div:nth-child(odd) { border-right: 0; }
  .value-card { grid-template-columns: 1fr; justify-items: center; }
  .value-card .lines { width: 100%; }
  .drawer-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .pop-from { transform: translateY(40px); }
  .palette { margin-top: 0; align-self: end; }
  .toasts { top: auto; bottom: 92px; right: 12px; left: 12px; width: auto; }
  .toast-from { transform: translateY(30px); }
  .bulk-bar { bottom: 88px; }
  .diff div { grid-template-columns: 1fr; gap: 2px; }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; z-index: 45; left: 10px; right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom)); height: 66px; border-radius: 22px; padding: 0 6px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line); box-shadow: 0 16px 40px -18px rgba(16, 52, 150, .45);
  }
  .bottom-nav a, .bottom-nav button { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); position: relative; }
  .bottom-nav a i { font-size: 18px; transition: transform var(--t) var(--ease-spring); }
  .bottom-nav a.on { color: var(--b-700); font-weight: 600; }
  .bottom-nav a.on i { transform: translateY(-2px) scale(1.1); }
  .bottom-nav a.on::after { content: ""; position: absolute; bottom: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--b-600); }
  .bottom-nav .fab-slot { display: grid; place-items: center; }
  .bottom-nav .fab-slot button { width: 54px; height: 54px; border-radius: 18px; background: var(--grad); color: #fff; font-size: 20px; margin-top: -26px; box-shadow: 0 14px 28px -10px rgba(30, 94, 234, .8); transition: transform var(--t) var(--ease-spring); }
  .bottom-nav .fab-slot button:active { transform: scale(.92); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Print
   ===================================================================== */
@media print {
  .sidebar, .topbar, .toolbar, .quick-chips, .filter-panel, .bottom-nav, .pager, .bulk-bar, .row-actions, .toasts { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* modal enter (rendered with x-if) */
.modal-wrap > .overlay { animation: fade-in .3s var(--ease) both; }
.modal-wrap > .modal { animation: modal-in .5s var(--ease-spring) both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
@media (max-width: 760px) { @keyframes modal-in { from { transform: translateY(100%); } } }
.a-card.selected { border-color: var(--b-400); box-shadow: 0 0 0 3px var(--b-100); }

/* ---- refinements ---- */
.dash-grid > .card { display: flex; flex-direction: column; }
.dash-grid > .card > .chart-box { flex: 1; min-height: 290px; }
.grid td.col-wrap { min-width: 150px; }
input[type=number]::-webkit-outer-spin-button, input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }
.ring.lg span { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.ring.lg small { font-family: var(--font); font-size: 12px; font-weight: 400; color: var(--muted); margin-top: 2px; }
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .dash-grid > .card > .chart-box { min-height: 240px; }
}
@media (max-width: 1023px) {
  .sidebar { z-index: 70; }
  .sidebar-overlay { z-index: 65 !important; }
}

/* ---- user modal ---- */
.switch { display: inline-block; vertical-align: middle; cursor: pointer; }
.switch input:disabled + span { opacity: .45; cursor: not-allowed; }
.user-modal { width: min(620px, 100%); }
.u-sec-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--b-700); letter-spacing: .02em; margin: 4px 0 12px; }
.u-sec-title:not(:first-child) { margin-top: 10px; padding-top: 18px; border-top: 1px dashed var(--line); }
.role-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.role-card {
  display: flex; align-items: flex-start; gap: 12px; text-align: left; padding: 14px; border-radius: 16px;
  border: 1.5px solid var(--line); background: #fff; position: relative;
  transition: border-color var(--t-fast), box-shadow var(--t) var(--ease), background var(--t-fast), transform var(--t-fast) var(--ease);
}
.role-card:hover { border-color: var(--b-300); }
.role-card:active { transform: scale(.98); }
.role-card .r-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--b-50); color: var(--b-600); font-size: 16px; transition: all var(--t) var(--ease); }
.role-card .r-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding-right: 18px; }
.role-card .r-txt b { font-weight: 600; font-size: 14.5px; }
.role-card .r-txt small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.role-card .r-check { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #fff; background: var(--b-600); transform: scale(0); transition: transform var(--t) var(--ease-spring); }
.role-card.on { border-color: var(--b-500); background: linear-gradient(180deg, #f5f9ff, #fff); box-shadow: 0 0 0 4px rgba(47, 123, 255, .12); }
.role-card.on .r-ico { background: var(--grad); color: #fff; box-shadow: 0 6px 14px -6px rgba(30, 94, 234, .7); }
.role-card.on .r-check { transform: scale(1); }
.opt-list { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; cursor: pointer; transition: background var(--t-fast); }
.opt-row + .opt-row { border-top: 1px solid var(--line-2); }
.opt-row:hover { background: var(--surface-2); }
.opt-row.disabled { cursor: default; }
.opt-row.disabled .o-txt b { color: var(--muted); }
.opt-row .o-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.opt-row .o-txt b { font-weight: 500; font-size: 14.5px; }
.opt-row .o-txt small { color: var(--muted); font-size: 12.5px; }
@media (max-width: 760px) { .role-cards { grid-template-columns: 1fr; } }

/* =====================================================================
   Credit (Developed by)
   ===================================================================== */
.app-foot { display: flex; justify-content: center; padding: 34px 0 6px; }
.credit-wrap { display: flex; justify-content: center; margin-top: 30px; }
.credit {
  display: inline-flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 99px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .72); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 12.5px; color: var(--muted); position: relative; overflow: hidden; isolation: isolate; max-width: 100%;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), transform var(--t) var(--ease);
}
.credit::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(61, 157, 255, .16) 50%, transparent 70%);
  transform: translateX(-110%); transition: transform .9s var(--ease);
}
.credit:hover { border-color: var(--b-200); box-shadow: 0 10px 24px -14px rgba(30, 94, 234, .55); transform: translateY(-1px); }
.credit:hover::after { transform: translateX(110%); }
.credit:active { transform: scale(.97); }

.credit-ring { position: relative; width: 30px; height: 30px; border-radius: 50%; padding: 2px; flex: none; display: grid; place-items: center; }
.credit-ring::before {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, #3d9dff, rgba(61, 157, 255, 0) 35%, #0b3a8c 55%, rgba(11, 58, 140, 0) 80%, #3d9dff);
  animation: rot 3.2s linear infinite;
}
.credit-mono {
  position: relative; width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: var(--grad); color: #fff; font: 600 10.5px/1 var(--font-display); letter-spacing: .3px;
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .9);
}
.credit-txt { display: grid; overflow: hidden; height: 19px; line-height: 19px; text-align: left; min-width: 0; }
.credit-txt > span { grid-area: 1 / 1; justify-self: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; animation: credit-out 9s var(--ease) infinite; }
.credit-txt > .c-th { animation-name: credit-in; color: var(--text-2); }
.credit:hover .credit-txt > span { animation-play-state: paused; }
.credit-txt b {
  font-weight: 600; background: linear-gradient(90deg, #0b3a8c, #1e5eea, #3d9dff, #1e5eea, #0b3a8c); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; animation: credit-shine 6s linear infinite;
}
.credit-go { font-size: 10px; opacity: 0; transform: translate(-4px, 4px); transition: all var(--t) var(--ease); color: var(--b-600); }
.credit:hover .credit-go { opacity: 1; transform: none; }
@keyframes credit-out {
  0%, 44% { transform: translateY(0); opacity: 1; }
  50%, 94% { transform: translateY(-100%); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}
@keyframes credit-in {
  0%, 44% { transform: translateY(100%); opacity: 0; }
  50%, 94% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(100%); opacity: 0; }
}
@keyframes credit-shine { to { background-position: 200% 0; } }

/* about card */
.about-card { width: min(380px, 100%); text-align: center; }
.about-head { position: relative; height: 118px; background: var(--grad); overflow: visible; flex: none; }
.about-head .mesh { opacity: .5; filter: blur(36px); overflow: hidden; }
.about-head .grid-lines { opacity: .12; }
.about-x { position: absolute; top: 14px; right: 14px; z-index: 2; }
.about-ring {
  position: absolute; left: 50%; bottom: -46px; transform: translateX(-50%); width: 96px; height: 96px; border-radius: 50%;
  padding: 4px; background: #fff; box-shadow: 0 16px 30px -14px rgba(16, 52, 150, .6); z-index: 2; display: grid; place-items: center;
}
.about-ring::before {
  content: ""; position: absolute; inset: -3px; border-radius: 50%; z-index: -1;
  background: conic-gradient(from 0deg, #3d9dff, rgba(61, 157, 255, 0) 30%, #0b3a8c 55%, rgba(11, 58, 140, 0) 80%, #3d9dff);
  animation: rot 4s linear infinite;
}
.about-mono {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; background: var(--grad); color: #fff;
  font: 600 30px/1 var(--font-display); letter-spacing: 1px; animation: about-pop .7s var(--ease-spring) .15s both;
}
@keyframes about-pop { from { transform: scale(.4) rotate(-20deg); opacity: 0; } }
.about-body { padding: 60px 26px 24px; }
.about-body > * { animation: rise .6s var(--ease) both; }
.about-body > *:nth-child(2) { animation-delay: .08s; } .about-body > *:nth-child(3) { animation-delay: .12s; }
.about-body > *:nth-child(4) { animation-delay: .16s; } .about-body > *:nth-child(5) { animation-delay: .2s; }
.about-body > *:nth-child(6) { animation-delay: .26s; } .about-body > *:nth-child(7) { animation-delay: .32s; }
.about-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--b-700); background: var(--b-50); border: 1px solid var(--b-100); padding: 3px 10px; border-radius: 99px; }
.about-body h3 { margin: 12px 0 0; font: 600 22px/1.3 var(--font-display); }
.about-en { margin: 2px 0 14px; color: var(--muted); font-size: 14px; letter-spacing: .02em; }
.about-role { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; color: var(--text-2); margin-top: 4px; }
.about-role i { color: var(--b-600); width: 16px; }
.about-sys { display: flex; align-items: center; gap: 12px; text-align: left; margin-top: 20px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line); }
.about-sys b { display: block; font-weight: 600; font-size: 14px; line-height: 1.3; }
.about-sys small { color: var(--muted); font-size: 12px; }
.about-year { margin-left: auto; font-size: 12px; color: var(--muted); }
.brand-mark.sm { width: 38px; height: 38px; border-radius: 12px; font-size: 16px; background: var(--grad); color: #fff; border: 0; flex: none; }
.about-love { margin: 16px 0 0; font-size: 12.5px; color: var(--muted); }
.about-love i { color: #ef4444; animation: beat 1.4s ease-in-out infinite; display: inline-block; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.25); } 30% { transform: scale(1); } 45% { transform: scale(1.15); } }
@media (max-width: 760px) {
  .app-foot { padding-top: 24px; }
  .about-card { border-radius: 24px 24px 0 0; }
}
@media print { .app-foot, .credit-wrap { display: none !important; } }
