/* SealHR Design System — 2026 */
:root {
  --seal-950: #042f2e;
  --seal-900: #0f4c49;
  --seal-800: #115e59;
  --seal-700: #0f766e;
  --seal-600: #0d9488;
  --seal-500: #14b8a6;
  --seal-400: #2dd4bf;
  --seal-300: #5eead4;
  --seal-100: #ccfbf1;
  --seal-50:  #f0fdfa;

  --coral-500: #f97316;
  --coral-600: #ea580c;

  --ink:    #0f172a;
  --muted:  #64748b;
  --line:   #e2e8f0;
  --surface:#f8fafc;
  --card:   #ffffff;

  --sidebar-w: 252px;
  --header-h: 60px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px rgba(15,23,42,.04);
  --font: 'LINESeedSansTH', 'Sarabun', system-ui, sans-serif;

  /* legacy alias → new tokens (modules ยังใช้ชื่อเดิมได้) */
  --navy-950: var(--seal-950);
  --navy-900: var(--seal-900);
  --navy-800: var(--seal-800);
  --navy-700: var(--seal-700);
  --gold-500: var(--seal-500);
  --gold-400: var(--seal-400);
  --gold-300: var(--seal-300);
  --paper: var(--surface);
  --ivory: var(--seal-50);
}

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

html, body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

/* ─── App Shell ─── */
.seal-app { display: flex; min-height: 100vh; }

.seal-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  transition: transform .25s ease;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.seal-brand-bar {
  padding: 1rem .75rem .7rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.seal-brand-dual {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 2px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  text-decoration: none;
  color: inherit;
  column-gap: .5rem;
}
.seal-brand-dual__org,
.seal-brand-dual__platform {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .15rem .2rem;
}
.seal-brand-dual__org-logo,
.seal-brand-dual__seal-logo {
  display: block;
  max-height: 68px;
  max-width: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
.seal-brand-dual__sep {
  width: 2px;
  min-width: 2px;
  height: 58px;
  background: #000;
  justify-self: center;
  align-self: center;
}
.seal-brand-dual__org-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--seal-50);
  color: var(--seal-700);
  font-size: 1.35rem;
}
.seal-brand-meta {
  margin-top: .55rem;
  text-align: center;
  min-width: 0;
}
.seal-brand-meta__name {
  font-size: .68rem;
  font-weight: 800;
  color: #475569;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seal-brand-meta__code {
  font-size: .6rem;
  font-family: ui-monospace, monospace;
  color: var(--seal-700);
  margin-top: .12rem;
}

.seal-nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: .75rem .65rem .35rem;
  overscroll-behavior: contain;
  overflow-anchor: none;
}
.seal-nav__group { margin-bottom: 1rem; }
.seal-nav__group:last-child { margin-bottom: .35rem; }
.seal-nav__label {
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #94a3b8;
  padding: .35rem .65rem .45rem;
}
.seal-nav__link {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .55rem .75rem;
  border-radius: 10px;
  font-size: .84rem;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  transition: background .15s, color .15s;
  margin-bottom: 2px;
  scroll-margin-top: 12px;
  scroll-margin-bottom: 12px;
}
.seal-nav__link i { width: 18px; text-align: center; font-size: .9rem; opacity: .85; }
.seal-nav__link:hover { background: var(--seal-50); color: var(--seal-800); }
.seal-nav__link.is-active {
  background: linear-gradient(135deg, var(--seal-700), var(--seal-600));
  color: #fff;
  box-shadow: 0 4px 14px rgba(15,118,110,.28);
}
.seal-nav__link.is-active i { opacity: 1; }

.seal-sidebar__foot {
  padding: .85rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, var(--seal-50));
}
.seal-user-chip {
  display: flex; align-items: center; gap: .65rem;
  padding: .55rem .65rem; border-radius: 12px;
  text-decoration: none; color: inherit;
  transition: background .15s;
}
.seal-user-chip:hover { background: var(--seal-50); }
.seal-user-chip__avatar {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--seal-600), var(--seal-400));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: .85rem;
}
.seal-user-chip__name { font-size: .78rem; font-weight: 700; line-height: 1.2; }
.seal-user-chip__role { font-size: .65rem; color: var(--muted); text-transform: capitalize; }

.seal-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.seal-header {
  height: var(--header-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  position: sticky;
  top: 0;
  z-index: 30;
}
.seal-header__title { font-size: 1.05rem; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: .5rem; }
.seal-header__title i { color: var(--seal-600); }
.seal-header__sub { font-size: .72rem; color: var(--muted); margin-top: 1px; }
.seal-header__actions { display: flex; align-items: center; gap: .5rem; }
.seal-icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.seal-icon-btn:hover { border-color: var(--seal-400); color: var(--seal-700); background: var(--seal-50); }
.seal-header-notif-count {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 999px; background: #ea580c; color: #fff; font-size: .6rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; line-height: 1;
}
.seal-nav__badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: #0f766e; color: #fff; font-size: .62rem; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center;
}
.seal-nav__badge--warn { background: #ea580c; }
.seal-nav__sev-group { margin-left: auto; display: inline-flex; gap: 3px; flex-shrink: 0; }
.seal-nav__sev {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  font-size: .58rem; font-weight: 800; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.seal-nav__sev--critical { background: #b91c1c; }
.seal-nav__sev--high { background: #ea580c; }
.seal-nav__sev--medium { background: #ca8a04; }
.seal-nav__sev--low { background: #64748b; }

.seal-dropdown { position: relative; }
.seal-dropdown__menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: .35rem; opacity: 0; visibility: hidden;
  transform: translateY(-4px); transition: all .15s;
}
.seal-dropdown:hover .seal-dropdown__menu { opacity: 1; visibility: visible; transform: none; }
.seal-dropdown__menu a {
  display: flex; align-items: center; gap: .5rem;
  padding: .55rem .75rem; border-radius: 8px; font-size: .82rem;
  color: #334155; text-decoration: none;
}
.seal-dropdown__menu a:hover { background: var(--seal-50); color: var(--seal-800); }
.seal-dropdown__menu a.danger { color: #dc2626; }
.seal-dropdown__menu a.danger:hover { background: #fef2f2; }

.seal-content { flex: 1; padding: 1.25rem 1.35rem 1.5rem; }

.seal-footer {
  padding: .85rem 1.25rem;
  border-top: 1px solid var(--line);
  background: #fff;
  font-size: .72rem;
  color: var(--muted);
  display: flex; justify-content: space-between; align-items: center;
}

/* Modal embed / fullwidth */
body.in-modal { background: var(--surface) !important; }
body.in-modal .seal-sidebar,
body.in-modal .seal-header,
body.in-modal .seal-footer { display: none !important; }
body.in-modal .seal-main { margin-left: 0 !important; }
body.in-modal .seal-content { padding: 1rem !important; }
body.pay-fs-layout .seal-sidebar { display: none !important; }
body.pay-fs-layout .seal-main { margin-left: 0 !important; }

@media (max-width: 1024px) {
  .seal-sidebar { transform: translateX(-100%); }
  .seal-sidebar.is-open { transform: none; box-shadow: 8px 0 32px rgba(0,0,0,.12); }
  .seal-main { margin-left: 0; }
}

/* Stat gradient cards — ใหม่ทั้งชุด */
.card-grad-blue   { background: linear-gradient(135deg, #0f766e, #14b8a6) !important; }
.card-grad-gold   { background: linear-gradient(135deg, #ea580c, #f97316) !important; }
.card-grad-purple { background: linear-gradient(135deg, #6d28d9, #8b5cf6) !important; }
.card-grad-cyan   { background: linear-gradient(135deg, #0369a1, #06b6d4) !important; }
.card-grad-rose   { background: linear-gradient(135deg, #be123c, #f43f5e) !important; }

.gold-divider { height: 1px; background: var(--line); margin: 1rem 0; }
.text-gold { color: var(--seal-600) !important; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--seal-500); }
