/* InvStock — Inventory & Stock Management Admin — full-width panel */

:root {
  /* Logo-matched palette */
  --brand-red: #c8102e;
  --brand-magenta: #d4145a;
  --brand-blue: #0a2a5c;
  --brand-blue-mid: #1a4a8c;
  --brand-blue-bright: #2d6bb8;
  --brand-star: #e31c3d;

  --shell: #ffffff;
  --surface: #f3f6fb;
  --surface-2: #e7edf6;
  --ink: #0a2a5c;
  --ink-soft: #4a5d7a;
  --ink-mute: #7a8ba3;
  --line: rgba(10, 42, 92, 0.08);
  --accent: var(--brand-magenta);
  --accent-soft: #fce4ec;
  --ok: #0f7a45;
  --ok-soft: #e6f6ee;
  --warn: #c45c12;
  --warn-soft: #fff1e6;
  --info: var(--brand-blue-mid);
  --info-soft: #e4eef9;
  --shadow-card: 0 8px 24px rgba(10, 42, 92, 0.07);
  --radius-card: 16px;
  --radius-pill: 999px;
  --sidebar-w: 84px;
  --font: "Manrope", sans-serif;
  --display: "Sora", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface);
  overflow: hidden;
}

body.os-body {
  background: #1a1410;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

html:has(body.os-body) {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.is-hidden,
[hidden] {
  display: none !important;
}

.welcome-block.is-hidden,
.welcome-block[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
  height: 0;
  overflow: hidden;
}

/* Legacy shell (unused in Mini OS mode; kept for non-OS embeds) */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  background: var(--shell);
  overflow: hidden;
}

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: #fff;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  flex-shrink: 0;
}

.topbar-left {
  justify-self: start;
  min-width: 0;
}

.topbar-brand-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  flex-shrink: 0;
}

.product-name {
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}

.product-tag {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--brand-magenta);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.top-menu {
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #eef3fa 0%, var(--surface) 100%);
  border: 1px solid rgba(10, 42, 92, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 4px 14px rgba(10, 42, 92, 0.06);
  width: max-content;
  max-width: 100%;
  min-width: 0;
  min-height: 44px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(10, 42, 92, 0.25) transparent;
}

.top-menu::-webkit-scrollbar {
  height: 4px;
}

.top-menu::-webkit-scrollbar-thumb {
  background: rgba(10, 42, 92, 0.25);
  border-radius: 999px;
}

.top-menu:empty {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  min-height: 0;
  overflow: hidden;
}

.top-menu-btn {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
  transition:
    background 0.2s var(--ease),
    color 0.2s var(--ease),
    box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}

.top-menu-btn:hover {
  color: var(--brand-blue);
  background: rgba(255, 255, 255, 0.7);
}

.top-menu-btn.is-active {
  background: linear-gradient(145deg, var(--brand-blue), var(--brand-blue-mid));
  color: #fff;
  box-shadow: 0 4px 14px rgba(10, 42, 92, 0.28);
  outline: 2px solid rgba(212, 20, 90, 0.35);
  outline-offset: 1px;
}

.top-menu-btn.is-active:hover {
  color: #fff;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
  flex-shrink: 0;
}

.icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:hover {
  background: var(--surface);
  color: var(--brand-blue);
}

.notif-dot {
  position: absolute;
  top: 10px;
  right: 11px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-magenta);
  border: 2px solid #fff;
}

.avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-blue), var(--brand-blue-mid));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.avatar-sm {
  width: 42px;
  height: 42px;
  font-size: 0.8rem;
}

/* User avatar dropdown */
.user-menu {
  position: relative;
}

.avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px 2px 2px;
  border-radius: var(--radius-pill);
  transition: background 0.2s var(--ease);
}

.avatar-btn:hover,
.user-menu.is-open .avatar-btn {
  background: var(--surface);
}

.avatar-caret {
  width: 14px;
  height: 14px;
  color: var(--ink-mute);
  transition: transform 0.2s var(--ease);
}

.user-menu.is-open .avatar-caret {
  transform: rotate(180deg);
  color: var(--brand-magenta);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 50;
  width: 280px;
  padding: 8px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px rgba(10, 42, 92, 0.16);
  animation: rise 0.2s var(--ease) both;
}

.user-dropdown-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 10px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.user-dropdown-head strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-blue);
}

.user-dropdown-head span {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-mute);
  margin-top: 2px;
  word-break: break-all;
}

.user-dropdown-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-soft);
  text-align: left;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.user-dropdown-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--brand-blue-mid);
}

.user-dropdown-item:hover {
  background: var(--surface);
  color: var(--brand-blue);
}

.user-dropdown-item.is-danger {
  color: var(--brand-magenta);
}

.user-dropdown-item.is-danger svg {
  color: var(--brand-magenta);
}

.user-dropdown-item.is-danger:hover {
  background: var(--accent-soft);
}

.user-dropdown-sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--line);
}

/* Profile page */
.profile-view {
  animation: rise 0.4s var(--ease) both;
}

.profile-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.profile-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  position: sticky;
  top: 0;
}

.profile-cover {
  height: 88px;
  background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-mid) 50%, var(--brand-magenta) 130%);
}

.profile-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 18px 18px;
  margin-top: -36px;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, var(--brand-blue), var(--brand-blue-mid));
  color: #fff;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 700;
  border: 4px solid #fff;
  box-shadow: 0 8px 20px rgba(10, 42, 92, 0.2);
  margin-bottom: 10px;
}

.profile-identity h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 1.1rem;
  color: var(--brand-blue);
}

.profile-role {
  margin: 0 0 10px;
  font-size: 0.82rem;
  color: var(--ink-mute);
  font-weight: 600;
}

.profile-badge {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.72rem;
  font-weight: 750;
}

.profile-meta-list {
  list-style: none;
  margin: 0;
  padding: 0 18px 18px;
  border-top: 1px solid var(--line);
}

.profile-meta-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.profile-meta-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.profile-meta-list span {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-mute);
}

.profile-meta-list strong {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--brand-blue);
  word-break: break-word;
}

.profile-forms {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.profile-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
}

.profile-panel-head {
  margin-bottom: 16px;
}

.profile-panel-head h3 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.05rem;
  color: var(--brand-blue);
}

.profile-panel-head p {
  margin: 0;
  font-size: 0.84rem;
  color: var(--ink-mute);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-full {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.75rem;
  font-weight: 750;
  color: var(--brand-blue);
  letter-spacing: 0.02em;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.field textarea {
  resize: vertical;
  min-height: 84px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-magenta);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(212, 20, 90, 0.12);
}

.pref-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pref-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 14px;
  border-radius: 14px;
  background: var(--surface);
  cursor: pointer;
}

.pref-row strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-blue);
  margin-bottom: 2px;
}

.pref-row span {
  font-size: 0.78rem;
  color: var(--ink-mute);
}

.pref-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand-magenta);
  flex-shrink: 0;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 650;
  box-shadow: 0 12px 28px rgba(10, 42, 92, 0.28);
  animation: rise 0.25s var(--ease) both;
}

/* Content */
.content {
  flex: 1;
  overflow: auto;
  padding: 20px 28px 32px;
  background: linear-gradient(180deg, #f7f9fc 0%, #ffffff 120px);
  scrollbar-width: thin;
  scrollbar-color: #c5d0e0 transparent;
}

.welcome-block {
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: var(--radius-card);
  background: linear-gradient(120deg, var(--brand-blue) 0%, var(--brand-blue-mid) 48%, var(--brand-magenta) 140%);
  color: #fff;
  box-shadow: 0 14px 36px rgba(10, 42, 92, 0.22);
  animation: rise 0.45s var(--ease) both;
}

.welcome-block .hero-copy h1 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.45rem, 2.2vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.welcome-block .hero-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.95rem;
}

.page-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  animation: rise 0.45s var(--ease) 0.05s both;
}

.page-heading h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}

.page-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  background: var(--brand-magenta);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 10px 22px rgba(212, 20, 90, 0.28);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
  flex-shrink: 0;
}

.primary-btn svg {
  width: 16px;
  height: 16px;
}

.primary-btn:hover {
  background: var(--brand-red);
  transform: translateY(-1px);
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-blue);
  font-weight: 700;
  font-size: 0.88rem;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.ghost-btn:hover {
  background: var(--surface);
  border-color: rgba(10, 42, 92, 0.22);
}

/* App modal (Master add / edit) */
.app-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
}

.app-modal.is-hidden,
.app-modal[hidden] {
  display: none !important;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 32, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: modal-fade-in 0.2s var(--ease) both;
}

.app-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(90dvh, 720px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 28px 64px rgba(8, 16, 32, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.4);
  overflow: hidden;
  animation: modal-rise-in 0.28s var(--ease) both;
}

.app-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc 0%, #fff 100%);
}

.app-modal-head h2 {
  margin: 0 0 4px;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: -0.02em;
}

.app-modal-head p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-mute);
}

.app-modal-close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-soft);
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}

.app-modal-close svg {
  width: 18px;
  height: 18px;
}

.app-modal-close:hover {
  background: var(--surface);
  color: var(--brand-magenta);
}

.app-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px 22px 22px;
  overflow: auto;
}

.app-modal-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.84rem;
  font-weight: 650;
}

.app-modal-error.is-hidden,
.app-modal-error[hidden] {
  display: none !important;
}

.app-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

@keyframes modal-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-rise-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 560px) {
  .app-modal-dialog {
    width: 100%;
    max-height: min(92dvh, 100%);
    border-radius: 16px;
  }

  .app-modal-head,
  .app-modal-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .app-modal-foot {
    flex-direction: column-reverse;
  }

  .app-modal-foot .ghost-btn,
  .app-modal-foot .primary-btn {
    width: 100%;
    justify-content: center;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: rise 0.45s var(--ease) both;
}

.stat-card:nth-child(1) { animation-delay: 0.06s; }
.stat-card:nth-child(2) { animation-delay: 0.1s; }
.stat-card:nth-child(3) { animation-delay: 0.14s; }
.stat-card:nth-child(4) { animation-delay: 0.18s; }

.stat-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-meta strong {
  display: block;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--brand-blue);
}

.stat-meta span {
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-weight: 600;
}

/* Soft tones for chips/stats — exclude OS app badges (those use gradient tones) */
.tone-rose:not(.desk-icon-badge):not(.cp-tile-icon):not(.os-title-icon):not(.taskbar-app-icon) {
  background: var(--accent-soft);
  color: var(--brand-magenta);
}
.tone-blue:not(.desk-icon-badge):not(.cp-tile-icon):not(.os-title-icon):not(.taskbar-app-icon) {
  background: var(--info-soft);
  color: var(--brand-blue);
}
.tone-green:not(.desk-icon-badge):not(.cp-tile-icon):not(.os-title-icon):not(.taskbar-app-icon) {
  background: var(--ok-soft);
  color: var(--ok);
}
.tone-amber:not(.desk-icon-badge):not(.cp-tile-icon):not(.os-title-icon):not(.taskbar-app-icon) {
  background: var(--warn-soft);
  color: var(--warn);
}

/* DataTable panel */
.table-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px 18px 10px;
  animation: rise 0.45s var(--ease) 0.12s both;
}

.table-panel-head {
  margin-bottom: 12px;
}

.table-panel-head h3 {
  margin: 0 0 2px;
  font-family: var(--display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand-blue);
}

.table-panel-head p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--ink-mute);
}

.table-wrap {
  overflow-x: auto;
}

/* DataTables skin */
table.dataTable {
  border-collapse: collapse !important;
  font-family: var(--font);
}

table.dataTable thead th {
  background: var(--surface) !important;
  color: var(--brand-blue) !important;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid rgba(10, 42, 92, 0.12) !important;
  padding: 12px 14px !important;
}

table.dataTable tbody td {
  padding: 12px 14px !important;
  border-bottom: 1px solid var(--line) !important;
  color: #111827;
  font-size: 0.875rem;
  vertical-align: middle;
}

table.dataTable.no-footer {
  border-bottom: 0 !important;
}

table.dataTable.table-striped > tbody > tr:nth-of-type(even) > td,
table.dataTable > tbody > tr.even > td {
  background-color: #ffffff !important;
}

table.dataTable.table-striped > tbody > tr:nth-of-type(odd) > td,
table.dataTable > tbody > tr.odd > td {
  background-color: var(--brand-tint-soft, #e8eef8) !important;
}

table.dataTable tbody tr:hover td {
  background: var(--brand-tint-hover, #dce7f6) !important;
  color: var(--brand-blue) !important;
}

.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 8px 4px;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 12px;
  margin-left: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(212, 20, 90, 0.12);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
  margin: 0 6px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button {
  border-radius: 8px !important;
  border: 0 !important;
  background: transparent !important;
  color: var(--brand-blue) !important;
  padding: 4px 10px !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--brand-magenta) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(212, 20, 90, 0.3);
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface) !important;
  color: var(--brand-blue) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  color: var(--ink-mute) !important;
  background: transparent !important;
}

.status-chip {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: capitalize;
}

.status-chip.active { background: var(--ok-soft); color: var(--ok); }
.status-chip.low { background: var(--warn-soft); color: var(--warn); }
.status-chip.out { background: var(--accent-soft); color: var(--brand-magenta); }
.status-chip.pending { background: var(--info-soft); color: var(--brand-blue-mid); }
.status-chip.draft { background: var(--surface-2); color: var(--ink-soft); }

/* DataTable row actions */
table.dataTable th.col-actions,
table.dataTable td.col-actions {
  width: 1%;
  white-space: nowrap;
  text-align: right !important;
  vertical-align: middle !important;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.row-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-blue);
  font-size: 0.72rem;
  font-weight: 700;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s;
}

.row-action-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.row-action-btn span {
  display: none;
}

.row-action-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(10, 42, 92, 0.22);
  background: var(--surface);
}

.row-action-view:hover {
  color: var(--brand-blue-mid);
  border-color: rgba(26, 74, 140, 0.35);
  background: var(--info-soft);
}

.row-action-edit:hover {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.35);
  background: #ecfdf5;
}

.row-action-print:hover {
  color: #a16207;
  border-color: rgba(161, 98, 7, 0.35);
  background: #fffbeb;
}

.row-action-delete {
  color: #b91c1c;
}

.row-action-delete:hover {
  color: #991b1b;
  border-color: rgba(185, 28, 28, 0.35);
  background: #fef2f2;
}

@media (min-width: 1100px) {
  .row-action-btn {
    padding: 0 10px;
  }

  .row-action-btn span {
    display: inline;
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .topbar {
    gap: 12px;
    padding: 12px 20px;
  }

  .topbar-brand-text {
    min-width: 0;
  }

  .product-tag {
    display: none;
  }

  .top-menu-btn {
    padding: 8px 12px;
  }
}

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 960px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 10px;
  }

  .topbar-brand-text .product-name {
    font-size: 0.92rem;
  }

  .top-menu {
    justify-self: center;
    width: max-content;
    max-width: 100%;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-card {
    position: static;
  }
}

@media (max-width: 900px) {
  /* Inside OS windows: taskbar already covers search / notify / user */
  .os-window .topbar {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    padding: 10px 12px;
  }

  .os-window .top-menu {
    justify-self: center;
    width: max-content;
    max-width: 100%;
  }

  .content {
    padding: 14px 12px 20px;
  }

  .welcome-block {
    padding: 16px;
  }

  .page-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .page-toolbar .primary-btn {
    width: 100%;
    justify-content: center;
  }

  .table-panel {
    padding: 14px 10px 8px;
  }

  table.dataTable thead th,
  table.dataTable tbody td {
    padding: 10px 10px !important;
    font-size: 0.8rem;
  }

  .dataTables_wrapper .dataTables_length,
  .dataTables_wrapper .dataTables_filter,
  .dataTables_wrapper .dataTables_info,
  .dataTables_wrapper .dataTables_paginate {
    float: none !important;
    text-align: left !important;
    width: 100%;
    padding: 6px 0;
  }

  .dataTables_wrapper .dataTables_filter input {
    width: min(100%, 220px);
    margin-left: 0;
    margin-top: 6px;
    display: block;
  }

  .dataTables_wrapper .dataTables_paginate {
    margin-top: 4px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(var(--os-taskbar-offset, 48px) + 12px);
    width: auto;
    text-align: center;
  }
}

@media (max-width: 820px) {
  body:not(.os-body) {
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    overflow-x: auto;
  }

  .side-nav {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    flex: 1;
    gap: 2px;
    overflow: visible;
  }

  .nav-item {
    min-width: 56px;
    padding: 4px 2px;
  }

  .nav-label {
    display: block;
    font-size: 8px;
  }

  .nav-icon {
    width: 30px;
    height: 30px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 12px 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .user-dropdown {
    width: min(280px, calc(100vw - 24px));
  }

  .pref-row {
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 560px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-brand {
    display: none;
  }

  .top-menu-btn {
    padding: 7px 11px;
    font-size: 0.78rem;
  }

  .page-heading h2 {
    font-size: 1.15rem;
  }

  .welcome-block h1 {
    font-size: 1.35rem;
  }
}

/* ——— Login ——— */
html:has(body.login-body) {
  height: auto;
  min-height: 100%;
  overflow: auto;
}

.login-body {
  overflow: auto;
  min-height: 100%;
  min-height: 100dvh;
  height: auto;
  background: var(--brand-blue);
}

.login-page {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: max(32px, env(safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right, 0px)) max(32px, env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  overflow: auto;
}

.login-atmosphere {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(196, 154, 58, 0.28) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(45, 107, 184, 0.45) 0%, transparent 50%),
    linear-gradient(160deg, #061a3a 0%, var(--brand-blue) 42%, #123a72 78%, #1a4a8c 100%);
  animation: login-glow 12s ease-in-out infinite alternate;
}

.login-atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 70% at 50% 40%, #000 20%, transparent 75%);
}

.login-main {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: rise 0.55s var(--ease) both;
}

.login-brand {
  text-align: center;
  color: #fff;
  animation: rise 0.55s var(--ease) 0.06s both;
}

/* Wide wordmark logo (not a square icon) */
.login-logo-wrap {
  width: min(300px, 100%);
  height: auto;
  margin: 0 auto 18px;
  padding: 14px 18px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  animation: login-logo-in 0.7s var(--ease) both;
}

.login-logo {
  width: 100%;
  max-width: 260px;
  height: auto;
  max-height: 72px;
  object-fit: contain;
  object-position: center;
  display: block;
}

.login-brand-name {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.75rem, 4vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #fff;
}

.login-title {
  margin: 0 0 8px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.01em;
}

.login-lead {
  margin: 0;
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.45;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 22px 20px;
  border-radius: var(--radius-card);
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.28);
  animation: rise 0.55s var(--ease) 0.12s both;
}

.login-form .field-label {
  color: var(--brand-blue);
}

.login-form .field-error {
  color: var(--brand-red) !important;
  font-size: 0.78rem;
  font-weight: 650;
  min-height: 0;
}

.login-form .field-error:empty {
  display: none;
}

.login-form .field input {
  background: #fff;
  border-color: #d7deea;
  color: #0a2a5c;
}

.login-form .field input::placeholder {
  color: #8a97ad;
}

.login-password-row {
  position: relative;
  display: flex;
  align-items: center;
}

.login-password-row input {
  padding-right: 44px;
}

.login-toggle-pw {
  position: absolute;
  right: 8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--ink-mute);
  transition: color 0.2s, background 0.2s;
}

.login-toggle-pw:hover {
  color: var(--brand-blue);
  background: var(--surface-2);
}

.login-toggle-pw svg {
  width: 18px;
  height: 18px;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 2px;
}

.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--brand-magenta);
}

.login-link {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand-magenta);
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.login-link:hover {
  color: var(--brand-red);
  text-decoration: underline;
}

.login-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fde8ec;
  color: var(--brand-red);
  font-size: 0.84rem;
  font-weight: 650;
}

.login-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
  padding: 13px 18px;
  font-size: 0.95rem;
}

.login-submit-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: login-spin 0.7s linear infinite;
}

.login-submit.is-loading {
  opacity: 0.9;
  pointer-events: none;
  cursor: progress;
}

.login-submit.is-loading .login-submit-spinner {
  display: inline-block;
}

.login-submit.is-loading .login-submit-arrow {
  display: none;
}

@keyframes login-spin {
  to { transform: rotate(360deg); }
}

.login-hint {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.5;
  animation: rise 0.55s var(--ease) 0.2s both;
}

.login-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.76rem;
  color: rgba(255, 255, 255, 0.78);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 6px;
}

@keyframes login-glow {
  from {
    filter: brightness(1);
  }
  to {
    filter: brightness(1.08);
  }
}

@keyframes login-logo-in {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 480px) {
  .login-page {
    align-items: flex-start;
    padding: max(40px, env(safe-area-inset-top, 0px)) 16px max(24px, env(safe-area-inset-bottom, 0px));
  }

  .login-logo-wrap {
    width: min(260px, 100%);
    padding: 12px 14px;
    margin-bottom: 14px;
  }

  .login-logo {
    max-width: 220px;
    max-height: 58px;
  }

  .login-brand-name {
    font-size: 1.55rem;
  }

  .login-title {
    font-size: 0.95rem;
  }

  .login-form {
    padding: 18px 16px 16px;
  }

  .login-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .login-hint {
    font-size: 0.78rem;
    word-break: break-word;
  }
}

/* ——— Release Updates ——— */
.releases-view {
  animation: rise 0.4s var(--ease) both;
}

.release-current {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
  padding: 22px 24px;
  border-radius: var(--radius-card);
  background: linear-gradient(125deg, var(--brand-blue) 0%, var(--brand-blue-mid) 55%, #9a1850 160%);
  color: #fff;
  box-shadow: 0 14px 36px rgba(10, 42, 92, 0.22);
  animation: rise 0.45s var(--ease) both;
}

.release-version-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  font-family: var(--display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  line-height: 1.2;
}

.release-current-copy h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.release-current-copy p {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.45;
}

.release-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.release-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  font-size: 0.74rem;
  font-weight: 700;
  color: #fff;
}

.release-current-aside {
  text-align: right;
}

.release-current-aside strong {
  display: block;
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.release-current-aside span {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
}

.release-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  animation: rise 0.45s var(--ease) 0.05s both;
}

.release-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.release-filter {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.2s var(--ease), color 0.2s, border-color 0.2s;
}

.release-filter:hover {
  border-color: rgba(212, 20, 90, 0.35);
  color: var(--brand-blue);
}

.release-filter.is-active {
  background: var(--brand-magenta);
  border-color: var(--brand-magenta);
  color: #fff;
  box-shadow: 0 8px 18px rgba(212, 20, 90, 0.25);
}

.release-count {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--ink-mute);
  white-space: nowrap;
}

.release-timeline {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-left: 18px;
}

.release-timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, var(--brand-magenta), rgba(10, 42, 92, 0.12));
  border-radius: 2px;
}

.release-entry {
  position: relative;
  padding: 20px 22px;
  border-radius: var(--radius-card);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  animation: rise 0.45s var(--ease) both;
}

.release-entry::before {
  content: "";
  position: absolute;
  left: -17px;
  top: 28px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand-magenta);
  box-shadow: 0 0 0 3px rgba(212, 20, 90, 0.12);
}

.release-entry.is-current {
  border-color: rgba(212, 20, 90, 0.28);
  box-shadow: 0 10px 28px rgba(212, 20, 90, 0.1);
}

.release-entry-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 10px;
}

.release-entry-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.release-entry-title-row h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--brand-blue);
  letter-spacing: -0.02em;
}

.release-type {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.7rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.release-type.major {
  background: var(--accent-soft);
  color: var(--brand-magenta);
}

.release-type.minor {
  background: var(--info-soft);
  color: var(--brand-blue-mid);
}

.release-type.patch {
  background: var(--ok-soft);
  color: var(--ok);
}

.release-entry-date {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--ink-mute);
}

.release-entry-summary {
  margin: 0 0 14px;
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.release-note-groups {
  display: grid;
  gap: 14px;
}

.release-note-group h4 {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-blue);
}

.release-note-group ul {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

.release-note-group li + li {
  margin-top: 4px;
}

.release-note-group.new h4 { color: var(--brand-magenta); }
.release-note-group.improved h4 { color: var(--brand-blue-mid); }
.release-note-group.fixed h4 { color: var(--ok); }

.release-build {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.78rem;
  color: var(--ink-mute);
  font-weight: 650;
}

.release-build span strong {
  color: var(--brand-blue);
  font-weight: 750;
}

@media (max-width: 820px) {
  .release-current {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .release-current-aside {
    text-align: left;
  }

  .release-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .release-timeline {
    padding-left: 14px;
  }

  .release-entry::before {
    left: -13px;
  }
}
