/* =========================================================
   PRAMUSTGALVIS V5 — ULTIMATE CLEAN SAAS CSS
   Pilnas app.css failas serverio versijai + stock papildymai
   ========================================================= */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fbff;
  --surface-3: #eef4fb;
  --text: #152334;
  --muted: #64748b;
  --line: #dbe5f0;
  --line-soft: #eaf0f6;
  --primary: #1f5fa8;
  --primary-2: #2d7be5;
  --primary-soft: #eaf2ff;
  --primary-strong: #194f8c;
  --success-bg: #edf9f0;
  --success-text: #166534;
  --error-bg: #fff1f2;
  --error-text: #b42318;
  --warning-bg: #fff7ed;
  --warning-text: #b45309;
  --sidebar: #0f2747;
  --sidebar-2: #14345f;
  --sidebar-text: #d8e7ff;
  --sidebar-text-dim: #97afcf;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius-xl: 24px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --sidebar-width: 280px;
  --topbar-height: 84px;
  --transition: 0.18s ease;
  --content-max: 1600px;

  /* Login + welcome theme tokens */
  --login-bg-1: #121f4f;
  --login-bg-2: #232f65;
  --login-bg-3: #2e346f;
  --login-bg-4: #232a63;
  --login-ribbon-bg: rgba(39, 48, 94, 0.92);
  --login-ribbon-line: rgba(255, 255, 255, 0.08);
  --login-card-bg: #f4f1ed;
  --login-card-line: #d9d2c9;
  --login-title: #182a40;
  --login-muted: #60758d;
  --login-input-bg: #f8fbff;
  --login-input-line: #d3dbe5;

  --wm-overlay-bg: rgba(6, 10, 22, 0.65);
  --wm-card-bg-start: #0d1630;
  --wm-card-bg-mid: #1a2744;
  --wm-card-bg-end: #0d1630;
  --wm-card-line: rgba(99, 140, 255, 0.22);
  --wm-title: #eef2ff;
  --wm-sub: rgba(160, 185, 255, 0.55);
}

body.theme-dark {
  --bg: #0b1320;
  --surface: #101c2c;
  --surface-2: #132338;
  --surface-3: #162a43;
  --text: #e6edf7;
  --muted: #9db0c6;
  --line: #213550;
  --line-soft: #1b2b40;
  --primary: #65a6ff;
  --primary-2: #8abaff;
  --primary-soft: #132946;
  --primary-strong: #4f97fb;
  --success-bg: #0f2a1a;
  --success-text: #7ce3a3;
  --error-bg: #35161b;
  --error-text: #ff9ea8;
  --warning-bg: #37240f;
  --warning-text: #ffcd7a;
  --sidebar: #08121f;
  --sidebar-2: #0f1c2e;
  --sidebar-text: #d6e6ff;
  --sidebar-text-dim: #8ca2bf;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.22);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

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

h1, h2, h3, h4, h5, h6 {
  color: var(--text);
}

/* ===== ICONS ===== */
.icon-wrap,
.nav-icon {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 20px;
  line-height: 0;
}

.icon-wrap svg,
.nav-icon svg {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  max-width: 20px !important;
  max-height: 20px !important;
  display: block !important;
  flex: 0 0 20px !important;
}

.icon-wrap svg *,
.nav-icon svg * {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2 !important;
  vector-effect: non-scaling-stroke;
}

/* ===== APP SHELL ===== */
.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  box-shadow: var(--shadow);
  padding: 18px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-logo {
  display: inline-flex;
  align-items: center;
}

.sidebar-logo img {
  width: auto;
  height: 42px;
}

.sidebar-close,
.menu-toggle,
.logout-link,
.topbar-chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  min-height: 42px;
  min-width: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), background var(--transition);
}

.sidebar-close:hover,
.menu-toggle:hover,
.logout-link:hover,
.topbar-chip:hover {
  transform: translateY(-1px);
}

.sidebar-close {
  display: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.nav-divider {
  margin: 8px 2px 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.nav-divider span {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--sidebar-text-dim);
  line-height: 1.3;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  color: var(--sidebar-text);
  background: transparent;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-link.active {
  background: rgba(101, 166, 255, 0.18);
  color: #fff;
}

.nav-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(101, 166, 255, 0.18);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  overflow: hidden;
}

.user-avatar.has-image,
.profile-avatar.has-image {
  background: rgba(255, 255, 255, 0.12);
}

.user-avatar img,
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-name {
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
}

.user-role {
  color: var(--sidebar-text-dim);
  font-size: 13px;
  line-height: 1.2;
}

.logout-link {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.main-shell {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 900;
  min-height: var(--topbar-height);
  background: rgba(244, 247, 251, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

body.theme-dark .topbar {
  background: rgba(11, 19, 32, 0.88);
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.menu-toggle {
  display: none;
}

.page-title {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.page-subtitle {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-chip {
  gap: 8px;
  padding: 0 14px;
  background: var(--surface);
}

.page-content {
  padding: 24px;
  max-width: var(--content-max);
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: stretch;
  min-height: calc(100vh - 84px);
}

/* ===== PANELS / CARDS ===== */
.hero-card,
.panel-card,
.section-panel,
.login-card,
.stock-card,
.content-card,
.compact-card,
.big-card,
.v5-panel-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
}

.hero-card {
  padding: 24px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.hero-card h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.08;
}

.hero-card p {
  margin: 0;
  color: var(--muted);
}

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

.panel-card,
.section-panel,
.compact-card,
.big-card,
.v5-panel-card {
  padding: 22px;
}

.page-pill,
.section-pill,
.v5-section-chip,
.login-kicker,
.pill-row > span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.card-grid {
  display: grid;
  gap: 18px;
}

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

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

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

/* ===== Shop Selector ===== */
.shop-selector {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  width: 100%;
  max-width: 1200px;
  padding: 40px 20px;
}

.shop-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px 32px;
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  cursor: pointer;
}

.shop-option:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.shop-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  min-height: 88px;
  -webkit-user-select: none;
  user-select: none;
}

.shop-icon svg {
  display: block;
  width: 72px;
  height: 72px;
  color: var(--primary-strong);
  filter:
    drop-shadow(0 0 5px rgba(87, 126, 191, 0.14))
    drop-shadow(0 0 10px rgba(130, 166, 223, 0.08));
  transition: filter var(--transition), transform var(--transition), color var(--transition);
}

.shop-icon-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: 78px;
  height: 78px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 5px rgba(87, 126, 191, 0.16))
    drop-shadow(0 0 12px rgba(130, 166, 223, 0.10));
  transition: filter var(--transition), transform var(--transition);
}

.shop-name {
  font-size: 28px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  word-wrap: break-word;
}

/* Tablet - 768px and down */
@media (max-width: 768px) {
  .shop-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-top: 32px;
  }
  
  .shop-option {
    padding: 36px 24px;
  }
  
  .shop-icon {
    width: 78px;
    height: 78px;
    min-height: 78px;
  }
  .shop-icon svg {
    width: 64px;
    height: 64px;
  }
  .shop-icon-image {
    width: 68px;
    height: 68px;
  }
  
  .shop-name {
    font-size: 22px;
  }
}

/* Mobile - 480px and down */
@media (max-width: 640px) {
  .shop-selector {
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 14px;
    margin-top: 24px;
  }
  
  .shop-option {
    padding: 32px 20px;
  }
  
  .shop-icon {
    width: 68px;
    height: 68px;
    min-height: 68px;
  }
  .shop-icon svg {
    width: 56px;
    height: 56px;
  }
  .shop-icon-image {
    width: 60px;
    height: 60px;
  }
  
  .shop-name {
    font-size: 20px;
  }
}

/* Small screens and low resolution */
@media (max-width: 480px) {
  .shop-selector {
    gap: 12px;
    margin-top: 20px;
  }
  
  .shop-option {
    padding: 24px 16px;
    gap: 16px;
  }
  
  .shop-icon {
    width: 60px;
    height: 60px;
    min-height: 60px;
  }
  .shop-icon svg {
    width: 48px;
    height: 48px;
  }
  .shop-icon-image {
    width: 52px;
    height: 52px;
  }
  
  .shop-name {
    font-size: 18px;
  }
}

/* Extra small - 320px */
@media (max-width: 360px) {
  .shop-selector {
    gap: 10px;
    margin-top: 16px;
  }
  
  .shop-option {
    padding: 20px 12px;
    gap: 12px;
    border-width: 2px;
  }
  
  .shop-icon {
    width: 54px;
    height: 54px;
    min-height: 54px;
  }
  .shop-icon svg {
    width: 42px;
    height: 42px;
  }
  .shop-icon-image {
    width: 46px;
    height: 46px;
  }
  
  .shop-name {
    font-size: 16px;
  }
}

/* Low DPI screens (old monitors with 96dpi, Windows 7) */
@media (resolution: 96dpi) {
  .shop-selector {
    gap: 20px;
  }
  
  .shop-option {
    padding: 42px 30px;
  }
  
  .shop-icon {
    width: 90px;
    height: 90px;
    min-height: 90px;
  }
  .shop-icon svg {
    width: 74px;
    height: 74px;
  }
  .shop-icon-image {
    width: 80px;
    height: 80px;
  }
  
  .shop-name {
    font-size: 26px;
  }
}

/* Very low resolution screens (800x600, 1024x768) */
@media (max-height: 600px) {
  .shop-selector {
    margin-top: 16px;
    gap: 12px;
  }
  
  .shop-option {
    padding: 20px 14px;
  }
  
  .shop-icon {
    width: 64px;
    height: 64px;
    min-height: 64px;
  }
  .shop-icon svg {
    width: 52px;
    height: 52px;
  }
  .shop-icon-image {
    width: 56px;
    height: 56px;
  }
  
  .shop-name {
    font-size: 18px;
  }
}

.section-head-v5,
.v5-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head-v5 h3,
.v5-section-head h3 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.1;
}

.muted-text {
  margin: 0;
  color: var(--muted);
}

.panel-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ===== FORMS ===== */
.project-form-v5,
.standard-form,
.v5-inline-adjust-form {
  display: grid;
  gap: 14px;
}

.form-grid,
.v5-form-grid {
  display: grid;
  gap: 14px;
}

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

.form-grid-3,
.v5-form-grid.form-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-field,
.v5-field {
  display: grid;
  gap: 8px;
}

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

.form-field label,
.v5-field label {
  font-weight: 700;
  font-size: 14px;
}

.form-field-notice {
  font-size: 12px;
  color: var(--muted);
}

input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary-2);
  box-shadow: 0 0 0 4px rgba(45, 123, 229, 0.12);
}

.inline-note {
  font-size: 13px;
  color: var(--muted);
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

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

.order-choice-block {
  display: grid;
  gap: 10px;
}

.order-choice-select,
.order-choice-new,
.transport-select-wrap {
  display: grid;
  gap: 8px;
}

.transport-box {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--surface-2);
}

.transport-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ===== PROJECT FORM PREMIUM ===== */
.project-form-premium {
  gap: 18px;
}

.project-step-title {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffffff 0%, #eaf2ff 100%);
  border: 1px solid rgba(31, 95, 168, 0.2);
  color: #134a85;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.project-compact-grid {
  align-items: end;
}

.project-compact-field {
  max-width: 300px;
}

.project-date-field {
  max-width: 220px;
}

.project-compact-input {
  min-height: 40px;
  border-radius: 12px;
}

.project-search-input {
  border: 1px solid rgba(31, 95, 168, 0.34);
  background: linear-gradient(180deg, #ffffff 0%, #f3f8ff 100%);
}

.project-material-input {
  border-color: rgba(31, 95, 168, 0.24);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.projects-page .project-form-v5 {
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(31, 95, 168, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

@media (max-width: 980px) {
  .project-compact-field,
  .project-date-field {
    max-width: none;
  }
}

/* ===== BUTTONS ===== */
.btn,
.v5-btn,
.v5-btn-primary,
.v5-btn-secondary,
.btn-block {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), border-color var(--transition);
}

.btn:hover,
.v5-btn:hover,
.v5-btn-primary:hover,
.v5-btn-secondary:hover {
  transform: translateY(-1px);
}

.btn-primary,
.v5-btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
}

.btn-secondary,
.v5-btn-secondary,
.v5-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.btn-block {
  width: 100%;
}

/* ===== TABLES ===== */
.table-wrap,
.v5-table-wrap {
  overflow-x: auto;
}

.data-table-v5,
.v5-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

.data-table-v5 th,
.data-table-v5 td,
.v5-table th,
.v5-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table-v5 thead th,
.v5-table thead th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
  background: var(--surface-2);
}

.table-main-text {
  font-weight: 700;
}

.table-sub-text {
  color: var(--muted);
  font-size: 13px;
}

.v5-mini-input,
.small-input,
.small-select {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.btn-small {
  min-height: 38px;
  padding: 0 12px;
  font-size: 13px;
}

/* ===== ALERTS ===== */
.alert,
.alert-error {
  padding: 14px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.alert-success-v5 {
  background: var(--success-bg);
  color: var(--success-text);
  border-color: rgba(22, 101, 52, 0.15);
}

.alert-error-v5,
.alert-error {
  background: var(--error-bg);
  color: var(--error-text);
  border-color: rgba(180, 35, 24, 0.16);
}

/* ===== EMPTY ===== */
.empty-state-v5,
.v5-empty-state {
  padding: 20px;
  border-radius: 16px;
  border: 1px dashed var(--line);
  background: var(--surface-2);
  color: var(--muted);
  display: grid;
  gap: 6px;
}

.empty-state-v5 strong,
.v5-empty-state strong {
  color: var(--text);
}

/* ===== LOGIN ===== */
.login-body,
.login-page {
  min-height: 100vh;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-page-wrap,
.login-shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
}

.login-box,
.login-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr 1fr;
}

.login-brand-card,
.login-main-card,
.login-card-premium {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.login-topbar {
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
}

.top-logo-wrap img {
  height: 54px;
  width: auto;
}

.login-head,
.login-heading-premium {
  margin-bottom: 16px;
}

.login-head h1,
.login-heading-premium h1 {
  margin: 0 0 8px;
  font-size: 34px;
}

.login-head p,
.login-heading-premium p {
  margin: 0;
  color: var(--muted);
}

/* ===== LOGIN LEGACY STYLE ===== */
.login-legacy-screen {
  background:
    radial-gradient(1200px 520px at 10% 12%, rgba(112, 127, 214, 0.18) 0%, rgba(15, 39, 71, 0) 60%),
    radial-gradient(900px 480px at 92% 88%, rgba(80, 105, 209, 0.14) 0%, rgba(15, 39, 71, 0) 64%),
    linear-gradient(145deg, var(--login-bg-1) 0%, var(--login-bg-2) 38%, var(--login-bg-3) 72%, var(--login-bg-4) 100%);
}

.login-page-legacy {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-legacy-shell {
  width: 100%;
  max-width: 760px;
  display: grid;
  gap: 24px;
}

.login-logo-ribbon {
  margin: 0 auto;
  width: min(100%, 460px);
  min-height: 78px;
  border-radius: 16px;
  background: var(--login-ribbon-bg);
  border: 1px solid var(--login-ribbon-line);
  box-shadow: 0 18px 36px rgba(8, 13, 34, 0.34);
  display: grid;
  place-items: center;
  padding: 12px 24px;
}

.login-logo-ribbon img {
  width: min(100%, 290px);
  height: auto;
  display: block;
}

.login-card-legacy {
  margin: 0 auto;
  width: min(100%, 410px);
  background: var(--login-card-bg);
  border: 1px solid var(--login-card-line);
  border-radius: 18px;
  padding: 24px 26px 20px;
  box-shadow: 0 24px 44px rgba(10, 16, 40, 0.24);
}

.login-tagline {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #8b5b20;
  background: #efe9e1;
  border: 1px solid #dacdbf;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-card-legacy h1 {
  margin: 10px 0 8px;
  font-size: 41px;
  line-height: 1.05;
  color: var(--login-title);
}

.login-intro {
  margin: 0 0 16px;
  color: var(--login-muted);
  font-size: 14px;
}

.login-role-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  background: #e5ddd3;
  border: 1px solid #d6cabd;
  border-radius: 12px;
  padding: 4px;
}

.login-role-btn {
  min-height: 38px;
  border: 1px solid transparent;
  background: transparent;
  color: #6e7f93;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.login-role-btn.active {
  background: #ffffff;
  color: #18334f;
  border-color: #d9dde3;
}

.login-pane {
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid #ddd6ce;
  border-radius: 16px;
  padding: 16px;
}

.login-pane.is-hidden {
  display: none;
}

.login-pane h2 {
  margin: 0 0 8px;
  font-size: 30px;
  line-height: 1.08;
  color: #16283f;
}

.login-pane p {
  margin: 0 0 10px;
  color: #677d94;
  font-size: 14px;
}

.login-form-legacy {
  display: grid;
  gap: 8px;
}

.login-form-legacy label {
  font-size: 14px;
  font-weight: 700;
  color: #1f3349;
}

.login-form-legacy input[type='text'],
.login-form-legacy input[type='password'] {
  width: 100%;
  min-height: 38px;
  border-radius: 10px;
  border: 1px solid var(--login-input-line);
  background: var(--login-input-bg);
  color: #1b2f45;
  padding: 0 12px;
}

.input-with-action {
  position: relative;
}

.input-with-action input {
  padding-right: 70px;
}

.input-action-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #6b7f95;
  font-size: 13px;
  font-weight: 700;
  padding: 0 8px;
  cursor: pointer;
}

.login-submit-btn {
  justify-self: start;
  margin-top: 6px;
  min-height: 34px;
  border-radius: 10px;
  padding: 0 14px;
  font-size: 14px;
}

.login-form-note {
  color: #667b92;
  font-size: 13px;
  margin-top: -2px;
}

.login-footer-note {
  margin-top: 16px;
  text-align: center;
  color: #74889f;
  font-size: 13px;
}

@media (max-width: 640px) {
  .login-card-legacy {
    width: 100%;
    padding: 18px;
  }

  .login-card-legacy h1 {
    font-size: 34px;
  }

  .login-pane h2 {
    font-size: 24px;
  }
}

/* ===== VIEW SWITCHERS ===== */
.view-switcher {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.switch-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.switch-link.active {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ===== STOCK COMMON ===== */
.tabs {
  display: flex;
  gap: 10px;
  margin: 0 0 18px;
  flex-wrap: wrap;
}

.tab {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
}

.tab.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(45, 123, 229, 0.25);
}

.inline-stock-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.inline-stock-form-stack {
  display: grid;
  gap: 8px;
}

.inline-stock-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr);
  gap: 8px;
}

.stock-inline-history {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.stock-accordion {
  display: grid;
  gap: 14px;
}

.stock-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
  overflow: hidden;
}

.stock-group-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  font-weight: 700;
}

.stock-group-summary::-webkit-details-marker {
  display: none;
}

.stock-group-title {
  color: var(--primary);
  font-size: 18px;
  line-height: 1.2;
}

.stock-group-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.stock-group-body {
  padding: 0 16px 16px;
}

.stock-subgroup + .stock-subgroup {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.stock-subgroup-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.stock-chip-list {
  display: grid;
  gap: 10px;
}

.stock-chip {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  flex-wrap: wrap;
}

.stock-chip-label {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 600;
}

.stock-manage-note {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ===== INLINE ADMIN STOCK CONTROLS ===== */
.stock-chip-manage {
  min-height: 52px;
}

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

.stock-chip-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

.stock-chip-input {
  width: 72px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.chip-action-btn {
  min-width: 36px;
  min-height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  cursor: pointer;
  font-weight: 800;
  background: var(--surface);
  color: var(--text);
}

.chip-action-minus {
  color: #b42318;
}

.chip-action-plus {
  color: #166534;
}

/* ===== ADJUSTMENTS ===== */
.adjustments-page .card-grid-2 {
  align-items: start;
}

.adjustment-note {
  font-size: 12px;
  color: #6b7d90;
}

body.theme-dark .adjustment-note {
  color: #b8c8d7;
}

/* ===== MOBILE ===== */
.mobile-overlay {
  display: none;
}

@media (max-width: 980px) {
  .sidebar-close {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
    z-index: 1000;
  }

  .mobile-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  .main-shell {
    margin-left: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .topbar {
    padding: 16px 18px;
  }

  .page-content {
    padding: 18px;
  }

  .card-grid-2,
  .card-grid-3,
  .card-grid-4,
  .form-grid-2,
  .form-grid-3,
  .login-box,
  .login-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-chip span:last-child {
    display: none;
  }

  .hero-card {
    flex-direction: column;
  }

  .inline-stock-row {
    grid-template-columns: 1fr;
  }

  .stock-chip {
    align-items: flex-start;
  }

  .stock-chip-actions {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .hero-card h2 {
    font-size: 24px;
  }

  .page-title {
    font-size: 22px;
  }

  .section-panel,
  .panel-card,
  .login-card-premium,
  .login-brand-card,
  .login-main-card {
    padding: 18px;
  }

  .stock-chip-form {
    width: 100%;
  }

  .stock-chip-input {
    flex: 1 1 auto;
    width: auto;
  }
}

/* ===== BUTTON VARIANTS ===== */
.btn-sm,
.btn-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  border-radius: 10px;
}

.btn-xs {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: 8px;
}

.btn-danger {
  background: #b42318;
  color: #fff;
  border-color: #b42318;
}

.btn-danger:hover {
  background: #8f1c14;
}

.btn-warning {
  background: #b45309;
  color: #fff;
  border-color: #b45309;
}

.btn-warning:hover {
  background: #8f4107;
}

.btn-success {
  background: #166534;
  color: #fff;
  border-color: #166534;
}

.btn-success:hover {
  background: #0f4a25;
}

body.theme-dark .btn-danger { background: #c0392b; border-color: #c0392b; }
body.theme-dark .btn-warning { background: #e67e22; border-color: #e67e22; }
body.theme-dark .btn-success { background: #27ae60; border-color: #27ae60; }

/* ===== BADGES ===== */
.badge,
.badge-active,
.badge-inactive,
.badge-pinned,
.badge-unread,
.badge-warning,
.badge-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.badge-active {
  background: var(--success-bg);
  color: var(--success-text);
}

.badge-inactive {
  background: var(--surface-3);
  color: var(--muted);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning-text);
}

.badge-info {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-pinned {
  background: #fef3c7;
  color: #b45309;
}

.badge-unread {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}

body.theme-dark .badge-pinned { background: #37240f; color: #ffcd7a; }

/* ===== TABLE ACTIONS ===== */
.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== CARD HIGHLIGHT ===== */
.card-highlight {
  border: 2px solid var(--primary);
  background: var(--primary-soft);
}

/* ===== MESSAGES ===== */
.messages-list {
  display: grid;
  gap: 12px;
}

.message-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}

.message-unread {
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
}

.message-pinned {
  border-left: 3px solid #b45309;
}

.message-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.message-subject {
  font-weight: 800;
  font-size: 15px;
  line-height: 1.3;
}

.message-body {
  color: var(--muted);
  font-size: 14px;
}

.message-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
}

.message-shop {
  background: var(--surface-3);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
}

.message-from {
  font-size: 13px;
  font-weight: 600;
}

.message-date {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
}

/* ===== EXPORT BUTTONS ===== */
.export-btn-list {
  display: grid;
  gap: 10px;
}

/* ===== BIG CARD LINKS ===== */
.big-card-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  transition: border-color var(--transition), transform var(--transition);
}

.big-card-link:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  color: var(--primary);
}

.big-card-link .link-icon {
  font-size: 24px;
  flex-shrink: 0;
}

/* ===== OVERVIEW PREMIUM ===== */
.overview-page .page-content {
  width: 100%;
  align-items: stretch;
  justify-content: flex-start;
  min-height: auto;
}

.overview-shell {
  display: grid;
  gap: 18px;
  width: 100%;
}

.overview-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  background: linear-gradient(135deg, #0f2747 0%, #1f5fa8 58%, #2d7be5 100%);
  color: #f5f9ff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 20px 42px rgba(15, 39, 71, 0.25);
}

.overview-hero h2,
.overview-hero p {
  color: #f5f9ff;
  position: relative;
  z-index: 1;
}

.overview-kicker {
  background: rgba(255, 255, 255, 0.16);
  color: #eaf3ff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.overview-hero-glow {
  position: absolute;
  right: -120px;
  top: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 70%);
  z-index: 0;
}

.overview-hero-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 250px;
  max-width: 300px;
  align-self: flex-start;
}

.overview-hero-stat {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.09);
}

.overview-hero-stat span {
  font-size: 11px;
  color: rgba(234, 243, 255, 0.88);
  font-weight: 600;
}

.overview-hero-stat strong {
  font-size: 18px;
  line-height: 1;
  color: #ffffff;
}

.overview-module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.overview-module-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 24px 22px;
  border-radius: 20px;
  border: 2px solid rgba(31, 95, 168, 0.18);
  background: linear-gradient(180deg, #ffffff 0%, #f4f9ff 100%);
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(17, 35, 59, 0.08);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background var(--transition);
}

.overview-module-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 95, 168, 0.52);
  box-shadow: 0 18px 34px rgba(21, 35, 52, 0.14);
  background: linear-gradient(180deg, #ffffff 0%, #ecf5ff 100%);
}

.overview-module-icon {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 88px;
  color: var(--primary-strong);
}

.overview-module-image {
  display: block;
  width: 86px;
  height: 86px;
  object-fit: contain;
  filter:
    drop-shadow(0 0 5px rgba(87, 126, 191, 0.16))
    drop-shadow(0 0 12px rgba(130, 166, 223, 0.10));
  transition: filter var(--transition), transform var(--transition);
}

.overview-module-card:hover .overview-module-image {
  filter:
    drop-shadow(0 0 8px rgba(87, 126, 191, 0.24))
    drop-shadow(0 0 18px rgba(130, 166, 223, 0.18));
}

.overview-module-icon svg {
  display: block;
  width: 82px;
  height: 82px;
  filter:
    drop-shadow(0 0 5px rgba(87, 126, 191, 0.14))
    drop-shadow(0 0 10px rgba(130, 166, 223, 0.08));
  transition: filter var(--transition), transform var(--transition), color var(--transition);
}

.overview-module-card:hover .overview-module-icon svg {
  filter:
    drop-shadow(0 0 8px rgba(87, 126, 191, 0.24))
    drop-shadow(0 0 18px rgba(130, 166, 223, 0.18));
}

body.theme-dark .overview-module-icon svg {
  filter:
    drop-shadow(0 0 0.8px rgba(255, 255, 255, 0.95))
    drop-shadow(0 0 1.6px rgba(255, 255, 255, 0.92))
    drop-shadow(0 0 6px rgba(87, 126, 191, 0.22))
    drop-shadow(0 0 14px rgba(130, 166, 223, 0.14));
}

body.theme-dark .overview-module-card:hover .overview-module-icon svg {
  filter:
    drop-shadow(0 0 1px rgba(255, 255, 255, 0.98))
    drop-shadow(0 0 2px rgba(255, 255, 255, 0.94))
    drop-shadow(0 0 8px rgba(87, 126, 191, 0.28))
    drop-shadow(0 0 18px rgba(130, 166, 223, 0.18));
}

.overview-module-title {
  font-size: 27px;
  font-weight: 800;
  line-height: 1.25;
}

.overview-module-link {
  font-size: 13px;
  color: var(--primary-strong);
  font-weight: 700;
}

.overview-data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.overview-data-card .table-wrap {
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
}

@media (max-width: 1180px) {
  .overview-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .overview-module-title {
    font-size: 23px;
  }
}

@media (max-width: 900px) {
  .overview-hero {
    flex-direction: column;
  }

  .overview-hero-stats {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .overview-data-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .overview-module-grid {
    grid-template-columns: 1fr;
  }

  .overview-hero {
    padding: 18px;
  }

  .overview-module-title {
    font-size: 21px;
  }

  .overview-module-icon {
    font-size: 30px;
  }
}

/* ===== MODULE PAGES PREMIUM ===== */
.projects-page .page-content,
.stock-page .page-content,
.stats-page .page-content,
.requests-page .page-content {
  width: 100%;
  align-items: stretch;
  justify-content: flex-start;
  min-height: auto;
}

.projects-page .hero-card,
.stock-page .hero-card,
.requests-page .hero-card,
.stats-page .stats-head-main {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f2747 0%, #1f5fa8 58%, #2d7be5 100%);
  color: #f5f9ff;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 42px rgba(15, 39, 71, 0.25);
  padding: 22px;
  margin-bottom: 18px;
}

.projects-page .hero-card::after,
.stock-page .hero-card::after,
.requests-page .hero-card::after,
.stats-page .stats-head-main::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
}

.projects-page .hero-card h2,
.projects-page .hero-card p,
.stock-page .hero-card h2,
.stock-page .hero-card p,
.requests-page .hero-card h2,
.requests-page .hero-card p,
.stats-page .stats-head-main h2,
.stats-page .stats-head-main p,
.stats-page .stats-head-main .muted-text,
.stats-page .stats-head-main .muted-text strong {
  color: #f5f9ff;
  position: relative;
  z-index: 1;
}

.projects-page .hero-card .page-pill,
.stock-page .hero-card .page-pill,
.requests-page .hero-card .page-pill {
  background: rgba(255, 255, 255, 0.16);
  color: #eaf3ff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.projects-page .hero-actions,
.stock-page .hero-actions,
.stats-page .stats-head-actions {
  position: relative;
  z-index: 1;
}

.projects-page .hero-actions .btn,
.stock-page .hero-actions .btn,
.stats-page .stats-head-actions .btn {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.projects-page .hero-actions .btn:hover,
.stock-page .hero-actions .btn:hover,
.stats-page .stats-head-actions .btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.projects-page .panel-card,
.projects-page .section-panel,
.stock-page .panel-card,
.stock-page .section-panel,
.stats-page .panel-card,
.stats-page .section-panel,
.requests-page .panel-card,
.requests-page .section-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.07);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.projects-page .project-kpi-grid .compact-card,
.stats-page .stats-kpi-grid .compact-card {
  border: 1px solid rgba(31, 95, 168, 0.2);
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}

.stats-page .stats-kpi-grid .stats-kpi-card {
  position: relative;
  overflow: hidden;
  min-height: 168px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(31, 95, 168, 0.16);
  border-radius: 20px;
  background: linear-gradient(160deg, #ffffff 0%, #f4f8ff 56%, #e9f1ff 100%);
  box-shadow: 0 14px 28px rgba(15, 39, 71, 0.08);
}

.stats-page .stats-kpi-grid .stats-kpi-card::after {
  content: "";
  position: absolute;
  right: -42px;
  top: -48px;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 95, 168, 0.2) 0%, rgba(31, 95, 168, 0) 72%);
  pointer-events: none;
}

.stats-page .stats-kpi-grid .stats-kpi-card-accent {
  border-color: rgba(22, 91, 182, 0.24);
  background: linear-gradient(160deg, #ffffff 0%, #edf4ff 48%, #dfedff 100%);
}

.stats-page .stats-kpi-grid .stats-kpi-card-manager {
  border-color: rgba(16, 120, 94, 0.22);
  background: linear-gradient(160deg, #ffffff 0%, #f0fbf8 56%, #e1f7f1 100%);
}

.stats-page .stats-kpi-grid .stats-kpi-label {
  position: relative;
  z-index: 1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #3b556f;
}

.stats-page .stats-kpi-grid .stats-kpi-value {
  position: relative;
  z-index: 1;
  margin: 2px 0 0;
  font-size: clamp(34px, 2.7vw, 44px);
  line-height: 1;
  font-weight: 900;
  color: #0f2747;
  letter-spacing: -0.02em;
}

.stats-page .stats-kpi-grid .stats-kpi-value span {
  font-size: 0.56em;
  font-weight: 700;
  color: #365777;
}

.stats-page .stats-kpi-grid .stats-kpi-meta {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: #54708d;
}

.stats-page .stats-kpi-grid .stats-kpi-manager-name {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  font-size: clamp(28px, 2.25vw, 36px);
  line-height: 1.1;
  font-weight: 900;
  color: #083a35;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.stats-page .stats-kpi-grid .stats-kpi-manager-total {
  position: relative;
  z-index: 1;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(16, 120, 94, 0.22);
  background: rgba(255, 255, 255, 0.66);
  font-size: 13px;
  font-weight: 700;
  color: #0f6a59;
}

.projects-page .project-kpi-grid .compact-card span {
  font-size: 30px;
  font-weight: 800;
  color: #0f2747;
}

.stock-page .view-switcher,
.stats-page .tabs {
  margin-bottom: 16px;
}

.stock-page .switch-link,
.stats-page .tab {
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.stock-page .switch-link.active,
.stats-page .tab.active {
  border-color: rgba(31, 95, 168, 0.36);
  background: linear-gradient(180deg, #ffffff 0%, #eaf2ff 100%);
}

.requests-page .card-grid-2 {
  align-items: start;
}

.requests-page .section-panel h3,
.projects-page .section-panel h3,
.stock-page .section-panel h3,
.stats-page .section-panel h3 {
  font-size: 22px;
}

@media (max-width: 980px) {
  .projects-page .hero-card,
  .stock-page .hero-card,
  .requests-page .hero-card,
  .stats-page .stats-head-main {
    padding: 18px;
  }

  .projects-page .project-kpi-grid .compact-card span {
    font-size: 24px;
  }

  .stats-page .stats-kpi-grid .stats-kpi-card {
    min-height: 152px;
    padding: 18px;
  }

  .stats-page .stats-kpi-grid .stats-kpi-manager-name {
    font-size: 30px;
  }
}

/* ===== INLINE FORMS ===== */
.inline-form,
.inline-pin-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pin-change-row {
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  margin-top: 8px;
}

.perm-change-row {
  border-top: 1px dashed var(--line-soft);
}

.perm-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.perm-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 12px;
  white-space: nowrap;
}

.perm-chip input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
}

.pin-input-small {
  width: 90px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

/* ===== FORM GRID VARIANTS ===== */
.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 980px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ===== GLOBAL HELPERS ===== */
.is-hidden {
  display: none !important;
}

/* ===== MASTER MATERIALS ===== */
.material-kpm-input {
  max-width: 180px;
}

.material-kpm-inline-input {
  width: 70px;
}

/* ===== LANKSTYMAS CALCULATOR ===== */
.lankstymas-calc-block {
  padding: 14px 18px;
  margin-bottom: 10px;
}

.lankstymas-calc-head {
  margin-bottom: 10px;
}

.lankstymas-calc-subtext {
  margin: 0;
  font-size: 13px;
}

.lankstymas-calc-readonly {
  background: var(--surface-2);
}

.lankstymas-calc-result {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}

.lankstymas-calc-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* ===== STATS PAGE ===== */
.stats-head-main,
.stats-section-head {
  margin-bottom: 14px;
}

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

.stats-filter-panel,
.stats-kpi-grid,
.stats-tabs {
  margin-bottom: 18px;
}

.stats-filter-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr 0.85fr 1fr;
  gap: 14px;
}

@media (max-width: 1100px) {
  .stats-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 700px) {
  .stats-filter-grid {
    grid-template-columns: 1fr;
  }
}

.stats-filter-submit-wrap {
  align-self: end;
}

.stats-filter-submit {
  width: 100%;
}

.stats-chart-canvas {
  max-height: 220px;
}

.stats-latest-panel {
  margin-top: 18px;
}

.stats-project-material-line {
  font-size: 13px;
}

/* ===== PROFILE PAGE ===== */
.profile-page .page-content {
  width: 100%;
  align-items: stretch;
  justify-content: flex-start;
}

.profile-page .profile-hero {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(135deg, #0f2747 0%, #1f5fa8 58%, #2d7be5 100%);
  color: #f4f8ff;
  box-shadow: 0 22px 42px rgba(15, 39, 71, 0.24);
  padding: 24px;
  margin-bottom: 18px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}

.profile-page .profile-hero::after {
  content: "";
  position: absolute;
  right: -110px;
  top: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 72%);
}

.profile-page .profile-kicker {
  background: rgba(255, 255, 255, 0.15);
  color: #edf3ff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.profile-page .profile-hero h2,
.profile-page .profile-hero p {
  color: #f5f9ff;
  position: relative;
  z-index: 1;
}

.profile-page .profile-hero h2 {
  margin: 10px 0 8px;
}

.profile-page .profile-hero-meta {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.profile-page .profile-meta-item {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.profile-page .profile-meta-item span {
  color: rgba(237, 243, 255, 0.88);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-page .profile-meta-item strong {
  color: #ffffff;
  font-size: 14px;
}

.profile-page .profile-top-grid,
.profile-page .profile-security-grid {
  margin-bottom: 18px;
}

.profile-page .profile-info-card,
.profile-page .profile-settings-card,
.profile-page .profile-security-card,
.profile-page .profile-entries-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

.profile-page .profile-avatar-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line-soft);
}

.profile-page .profile-avatar {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: linear-gradient(180deg, #edf4ff 0%, #d9e8ff 100%);
  color: #0f2747;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  border: 1px solid rgba(31, 95, 168, 0.16);
  box-shadow: 0 10px 20px rgba(31, 95, 168, 0.12);
  overflow: hidden;
}

.profile-page .profile-avatar-form {
  flex: 1;
  display: grid;
  gap: 10px;
}

.profile-page .profile-avatar-form .form-field {
  margin: 0;
}

.profile-page .profile-security-metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.profile-page .profile-security-metric {
  border: 1px solid rgba(31, 95, 168, 0.2);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
}

.profile-page .profile-security-metric span {
  display: block;
  font-size: 12px;
  color: var(--security-metric-label);
  margin-bottom: 6px;
}

.profile-page .profile-security-metric strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
  color: var(--security-metric-value);
}

.profile-page .profile-entries-panel .data-table-v5 td:last-child {
  text-align: right;
}

@media (max-width: 980px) {
  .profile-page .profile-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .profile-page .profile-security-metrics {
    grid-template-columns: 1fr;
  }

  .profile-page .profile-avatar-block {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== WELCOME MODAL ===== */
.wm-overlay {
  position: fixed;
  inset: 0;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wm-overlay-bg);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  animation: wmOverIn .38s ease both;
}

.wm-overlay.wm-out {
  animation: wmOverOut .4s ease forwards;
}

.wm-card {
  position: relative;
  width: min(480px, 90vw);
  border-radius: 24px;
  background: linear-gradient(150deg, var(--wm-card-bg-start) 0%, var(--wm-card-bg-mid) 55%, var(--wm-card-bg-end) 100%);
  border: 1px solid var(--wm-card-line);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 40px 80px rgba(0, 0, 0, 0.7), 0 0 100px rgba(50, 90, 255, 0.12);
  padding: 52px 44px 44px;
  text-align: center;
  overflow: hidden;
  animation: wmCardIn .45s cubic-bezier(.22, 1, .36, 1) both;
}

.wm-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 15%;
  right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(130, 170, 255, 0.7), transparent);
}

.wm-card::after {
  content: "";
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  height: 120px;
  background: radial-gradient(ellipse, rgba(60, 100, 255, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.wm-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: 22px;
}

.wm-badge-worker {
  background: rgba(34, 197, 94, 0.1);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.28);
}

.wm-badge-admin {
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8;
  border: 1px solid rgba(99, 102, 241, 0.28);
}

.wm-badge-super {
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.14), rgba(239, 68, 68, 0.1));
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.38);
}

.wm-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--wm-title);
  line-height: 1.05;
}

.wm-sub {
  color: var(--wm-sub);
  font-size: 14px;
  font-weight: 500;
  margin: 0;
}

.wm-title-wrap {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.wm-greeting {
  font-size: clamp(24px, 4.5vw, 36px);
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--wm-title);
  line-height: 1;
}

.wm-avatar {
  width: 78px;
  height: 78px;
  margin: 18px auto 14px;
  border-radius: 999px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: rgba(99, 120, 255, 0.14);
  border: 2px solid rgba(160, 185, 255, 0.28);
  color: #eef2ff;
  font-size: 28px;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.24);
}

.wm-avatar.has-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.theme-light .wm-avatar {
  background: rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.2);
  color: #16356a;
}


.wm-btn {
  margin-top: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 26px;
  border-radius: 12px;
  border: 1px solid rgba(99, 120, 255, 0.28);
  background: rgba(99, 120, 255, 0.1);
  color: rgba(180, 205, 255, 0.75);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, color .18s, border-color .18s;
  letter-spacing: .02em;
}

.wm-btn:hover {
  background: rgba(99, 120, 255, 0.22);
  color: #c7d7ff;
  border-color: rgba(99, 120, 255, 0.5);
}

@keyframes wmOverIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes wmOverOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes wmCardIn {
  from {
    opacity: 0;
    transform: scale(.9) translateY(24px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wm-overlay,
  .wm-card {
    animation: none !important;
  }
}

/* =========================================================
   IMPROVEMENTS v5.1
   ========================================================= */

/* Fix: section head with h2 (not just h3) */
.section-head-v5 h2,
.v5-section-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.1;
}

/* Fix: page-content centered layout for shop-selector */
.page-content:has(.shop-selector) {
  align-items: center;
  justify-content: center;
}

/* Table: row hover effect for readability */
.data-table-v5 tbody tr:hover,
.v5-table tbody tr:hover {
  background: var(--surface-2);
  transition: background var(--transition);
}

/* Table: last row no bottom border */
.data-table-v5 tbody tr:last-child td,
.v5-table tbody tr:last-child td {
  border-bottom: 0;
}

/* Alert: fade-in animation */
@keyframes alertSlideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-success-v5,
.alert-error-v5 {
  animation: alertSlideIn 0.25s ease both;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid transparent;
}

/* Inline edit highlight row */
tr[data-entry-id][style*="background:#f3f8ff"] {
  background: var(--primary-soft) !important;
}

/* Improved: panel-card + section-panel padding uniformity */
.panel-card h3,
.section-panel h3 {
  margin-top: 0;
}

/* Improved: switch-link transition */
.switch-link {
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  font-size: 14px;
}

.switch-link:hover {
  background: var(--surface-3);
}

/* Improved: tab transition */
.tab {
  transition: background var(--transition), color var(--transition);
  font-size: 14px;
}

.tab:hover {
  background: var(--surface-3);
}

/* Improved: sidebar nav-link active indicator */
.nav-link.active {
  position: relative;
}

.nav-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--primary-2);
  border-radius: 0 4px 4px 0;
  opacity: 0.8;
}

/* Improved: button active press feedback */
.btn:active,
.v5-btn:active,
.v5-btn-primary:active,
.v5-btn-secondary:active {
  transform: translateY(0) scale(0.98);
}

/* Improved: shop-option icon animation */
.shop-option:hover .shop-icon {
  transform: scale(1.08);
  transition: transform var(--transition);
}

.shop-option:hover .shop-icon-image {
  filter:
    drop-shadow(0 0 8px rgba(87, 126, 191, 0.24))
    drop-shadow(0 0 18px rgba(130, 166, 223, 0.18));
}

/* Fix: mobile overlay background click to close */
.mobile-overlay {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.mobile-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

/* Improved: hero-card responsive */
@media (max-width: 640px) {
  .hero-card {
    flex-direction: column;
    gap: 12px;
  }

  .hero-actions {
    width: 100%;
  }

  .hero-actions .btn,
  .hero-actions .v5-btn {
    flex: 1;
    justify-content: center;
  }

  .page-title {
    font-size: 22px;
  }
}

/* Improved: card-grid-2 responsive */
@media (max-width: 860px) {
  .card-grid-2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .card-grid-3,
  .card-grid-4 {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .card-grid-3,
  .card-grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Improved: main-shell responsive */
@media (max-width: 980px) {
  .main-shell {
    margin-left: 0;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    transform: translateX(-110%);
    transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
  }

  .page-content {
    padding: 16px;
  }

  .topbar {
    padding: 14px 16px;
  }
}

/* Improved: form-grid-2 responsive */
@media (max-width: 640px) {
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Improved: stats filter grid */
@media (max-width: 640px) {
  .stats-filter-grid {
    grid-template-columns: 1fr;
  }
}

/* Improved: view-switcher on mobile */
@media (max-width: 640px) {
  .view-switcher {
    gap: 6px;
  }

  .switch-link {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
  }
}

/* Dark mode: better table head */
body.theme-dark .data-table-v5 thead th,
body.theme-dark .v5-table thead th {
  background: var(--surface-3);
}

/* Dark mode: input styling fix */
body.theme-dark input[type="text"],
body.theme-dark input[type="number"],
body.theme-dark input[type="password"],
body.theme-dark select,
body.theme-dark textarea {
  background: var(--surface-2);
  border-color: var(--line);
  color: var(--text);
}

/* Dark mode: panel cards */
body.theme-dark .panel-card,
body.theme-dark .section-panel,
body.theme-dark .v5-panel-card {
  border-color: var(--line);
}

/* Dark mode: nav-link active */
body.theme-dark .nav-link.active {
  background: rgba(101, 166, 255, 0.15);
}

/* Improved: profile-page grid fixes */
@media (max-width: 700px) {
  .profile-page .profile-top-grid {
    grid-template-columns: 1fr;
  }
}


/* ===== MASTER DASHBOARD STATUS CARDS ===== */
.status-card {
  display: flex;
  align-items: center;
}

.status-card-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.status-card strong {
  font-size: 15px;
  line-height: 1.35;
}

.status-badge {
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
}

body.theme-dark .status-badge {
  background: var(--primary-2);
}


/* ===== PROJECT FORM PLEVELES PREMIUM LAYOUT ===== */
.project-form-premium .pleveles-calc-box{
  padding:14px;
  border-radius:18px;
  background:linear-gradient(180deg,#eef6ff 0%,#f9fbff 100%);
  border:1px solid #d8e8fb;
  box-shadow:none;
}
.project-form-premium .pleveles-calc-box h4{
  margin:0 0 6px;
  font-size:18px;
  color:#1f5fa8;
}
.project-form-premium .transport-box-premium{
  margin-top:12px;
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
}
.project-form-premium .transport-trigger-grid{
  max-width:460px;
}
.project-form-premium .transport-animated-panel{
  display:grid;
  grid-template-rows:0fr;
  opacity:0;
  transform:translateY(-10px);
  transition:grid-template-rows .35s ease, opacity .25s ease, transform .25s ease, margin-top .25s ease;
  margin-top:0;
}
.project-form-premium .transport-animated-panel.is-open{
  grid-template-rows:1fr;
  opacity:1;
  transform:translateY(0);
  margin-top:14px;
}
.project-form-premium .transport-panel-inner{
  overflow:hidden;
}
.project-form-premium .transport-fields-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:16px;
  padding:18px;
  border:1px solid #dbe5f0;
  border-radius:20px;
  background:linear-gradient(180deg,#f8fbff 0%,#ffffff 100%);
  box-shadow:0 10px 24px rgba(15,23,42,.05);
}
.project-form-premium .transport-help{
  display:block;
  margin-top:8px;
  padding:10px 12px;
  border:1px solid rgba(180,83,9,.28);
  border-radius:12px;
  background:#fff7ed;
  color:#b45309;
  font-size:12px;
  font-weight:600;
}
@media (max-width: 980px){
  .project-form-premium .transport-fields-grid{
    grid-template-columns:1fr;
  }
  .project-form-premium .transport-trigger-grid{
    max-width:none;
  }
}


/* ===== THEME FIXES: per-user toggle / admin projects ===== */
body.theme-dark .projects-page .project-kpi-grid .compact-card,
body.theme-dark .stats-page .stats-kpi-grid .compact-card {
  border-color: rgba(101, 166, 255, 0.22);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
}

body.theme-dark .projects-page .project-kpi-grid .compact-card strong,
body.theme-dark .projects-page .project-kpi-grid .compact-card span,
body.theme-dark .stats-page .stats-kpi-grid .compact-card strong,
body.theme-dark .stats-page .stats-kpi-grid .compact-card span {
  color: var(--text);
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-accent,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-manager {
  border-color: var(--line);
  background: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 60%, var(--surface-3) 100%);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.22);
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-label,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-value,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-value span,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-meta,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-manager-name,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-manager-total {
  color: var(--text);
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-manager-total {
  background: rgba(19, 35, 56, 0.88);
  border-color: var(--line);
}

body.theme-dark .stock-page .switch-link,
body.theme-dark .stats-page .tab {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
}


/* ===== CLEAN THEME SYSTEM: unified light/dark surfaces ===== */
:root {
  --card-elevated-bg: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  --card-soft-bg: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  --card-accent-bg: linear-gradient(160deg, #ffffff 0%, #f4f8ff 56%, #e9f1ff 100%);
  --card-success-bg: linear-gradient(160deg, #ffffff 0%, #f0fbf8 56%, #e1f7f1 100%);
  --hero-ring: rgba(255, 255, 255, 0.18);
  --hero-btn-bg: rgba(255, 255, 255, 0.12);
  --hero-btn-bg-hover: rgba(255, 255, 255, 0.2);
  --hero-pill-bg: rgba(255, 255, 255, 0.16);
  --hero-pill-text: #eaf3ff;
  --hero-pill-border: rgba(255, 255, 255, 0.28);
  --kpi-title: #3b556f;
  --kpi-value: #0f2747;
  --kpi-meta: #54708d;
  --kpi-success: #083a35;
  --badge-soft-bg: #eef4ff;
  --badge-soft-text: #1f5fa8;
  --group-summary-bg: #f8fbff;
  --group-summary-text: #16324f;
  --edit-row-bg: #f8fbff;
  --calc-box-bg: linear-gradient(180deg,#eef6ff 0%,#f9fbff 100%);
  --calc-box-border: #d8e8fb;
  --warning-soft-bg: #fff7ed;
  --warning-soft-text: #b45309;
  --security-metric-label: #4a6178;
  --security-metric-value: #0f2747;
}

body.theme-dark {
  --card-elevated-bg: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  --card-soft-bg: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  --card-accent-bg: linear-gradient(160deg, var(--surface) 0%, var(--surface-2) 56%, var(--surface-3) 100%);
  --card-success-bg: linear-gradient(160deg, var(--surface) 0%, #143028 56%, #193b32 100%);
  --hero-ring: rgba(255, 255, 255, 0.16);
  --hero-btn-bg: rgba(255, 255, 255, 0.08);
  --hero-btn-bg-hover: rgba(255, 255, 255, 0.16);
  --hero-pill-bg: rgba(255, 255, 255, 0.1);
  --hero-pill-text: #eef4ff;
  --hero-pill-border: rgba(255, 255, 255, 0.2);
  --kpi-title: var(--muted);
  --kpi-value: var(--text);
  --kpi-meta: var(--muted);
  --kpi-success: #9ce6d6;
  --badge-soft-bg: rgba(101, 166, 255, 0.12);
  --badge-soft-text: #aecdff;
  --group-summary-bg: rgba(255, 255, 255, 0.04);
  --group-summary-text: var(--text);
  --edit-row-bg: rgba(255, 255, 255, 0.04);
  --calc-box-bg: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  --calc-box-border: var(--line);
  --warning-soft-bg: rgba(180,83,9,.12);
  --warning-soft-text: #ffcd7a;
  --security-metric-label: #a8bbd2;
  --security-metric-value: #f2f7ff;
}

.overview-module-card,
.projects-page .project-form-v5,
.projects-page .project-kpi-grid .compact-card,
.stats-page .stats-kpi-grid .compact-card,
.stats-page .stats-kpi-grid .stats-kpi-card,
.stats-page .stats-kpi-grid .stats-kpi-card-accent,
.stats-page .stats-kpi-grid .stats-kpi-card-manager,
.stock-page .switch-link,
.stats-page .tab,
.profile-page .profile-security-metric,
.project-form-premium .pleveles-calc-box,
.project-form-premium .transport-fields-grid {
  background: var(--card-elevated-bg);
}

.overview-module-card,
.projects-page .project-form-v5,
.projects-page .project-kpi-grid .compact-card,
.stats-page .stats-kpi-grid .compact-card,
.stats-page .stats-kpi-grid .stats-kpi-card,
.stats-page .stats-kpi-grid .stats-kpi-card-accent,
.stats-page .stats-kpi-grid .stats-kpi-card-manager,
.stock-page .switch-link,
.stats-page .tab,
.profile-page .profile-security-metric,
.project-form-premium .pleveles-calc-box,
.project-form-premium .transport-fields-grid,
.master-page .material-group-card {
  border-color: var(--line);
  color: var(--text);
}

.projects-page .hero-card,
.stock-page .hero-card,
.requests-page .hero-card,
.stats-page .stats-head-main,
.profile-page .profile-hero {
  border-color: var(--hero-ring);
}

.projects-page .hero-card .page-pill,
.stock-page .hero-card .page-pill,
.requests-page .hero-card .page-pill,
.profile-page .profile-kicker {
  background: var(--hero-pill-bg);
  color: var(--hero-pill-text);
  border-color: var(--hero-pill-border);
}

.projects-page .hero-actions .btn,
.stock-page .hero-actions .btn,
.stats-page .stats-head-actions .btn {
  background: var(--hero-btn-bg);
  color: #fff;
  border-color: var(--hero-pill-border);
}

.projects-page .hero-actions .btn:hover,
.stock-page .hero-actions .btn:hover,
.stats-page .stats-head-actions .btn:hover {
  background: var(--hero-btn-bg-hover);
}

.overview-module-card:hover {
  background: var(--card-soft-bg);
}

.project-step-title {
  background: var(--card-soft-bg);
  color: var(--primary);
  border-color: rgba(31, 95, 168, 0.18);
}

.project-search-input,
.project-material-input {
  background: var(--card-elevated-bg);
  border-color: rgba(31, 95, 168, 0.18);
}

.projects-page .project-form-v5,
.projects-page .project-form-v5 .form-field label,
.projects-page .project-form-v5 h3,
.projects-page .project-form-v5 h4 {
  color: var(--text);
}

.projects-page .project-form-v5 {
  box-shadow: var(--shadow-soft);
}

.projects-page .project-kpi-grid .compact-card span,
.stats-page .stats-kpi-grid .compact-card span {
  color: var(--kpi-value);
}

.stats-page .stats-kpi-grid .stats-kpi-label {
  color: var(--kpi-title);
}

.stats-page .stats-kpi-grid .stats-kpi-value,
.stats-page .stats-kpi-grid .stats-kpi-value span {
  color: var(--kpi-value);
}

.stats-page .stats-kpi-grid .stats-kpi-meta {
  color: var(--kpi-meta);
}

.stats-page .stats-kpi-grid .stats-kpi-manager-name {
  color: var(--kpi-success);
}

.stats-page .stats-kpi-grid .stats-kpi-manager-total {
  background: rgba(255,255,255,.66);
  border-color: var(--line);
  color: var(--kpi-success);
}

.stock-page .switch-link,
.stats-page .tab {
  box-shadow: var(--shadow-soft);
  color: var(--text);
}

.stock-page .switch-link.active,
.stats-page .tab.active {
  background: var(--card-soft-bg);
}

.project-form-premium .pleveles-calc-box {
  background: var(--calc-box-bg);
  border-color: var(--calc-box-border);
}

.project-form-premium .pleveles-calc-box h4,
.project-form-premium .pleveles-calc-multiply {
  color: var(--primary);
}

.project-form-premium .transport-fields-grid {
  background: var(--card-elevated-bg);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.project-form-premium .transport-help {
  background: var(--warning-soft-bg);
  color: var(--warning-soft-text);
}

.master-page .material-groups-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.master-page .material-group-card {
  border: 1px solid var(--line) !important;
  border-radius: 18px;
  background: var(--card-elevated-bg) !important;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.master-page .material-group-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--group-summary-bg) !important;
}

.master-page .material-group-summary::-webkit-details-marker {
  display: none;
}

.master-page .material-group-summary-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.master-page .material-group-title {
  font-weight: 700;
  color: var(--group-summary-text);
}

.master-page .material-group-badge {
  background: var(--badge-soft-bg) !important;
  color: var(--badge-soft-text) !important;
}

.master-page .material-group-hint {
  font-size: 13px;
}

.master-page .material-group-body {
  padding: 10px 14px 14px;
}

.master-page .material-group-empty {
  padding: 18px 12px;
}

.master-page .material-edit-cell {
  background: var(--edit-row-bg) !important;
}

.master-page .inline-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--muted);
}

body.theme-light .projects-page .project-kpi-grid .compact-card,
body.theme-light .stats-page .stats-kpi-grid .compact-card,
body.theme-light .stats-page .stats-kpi-grid .stats-kpi-card,
body.theme-light .stats-page .stats-kpi-grid .stats-kpi-card-accent,
body.theme-light .stats-page .stats-kpi-grid .stats-kpi-card-manager,
body.theme-light .overview-module-card,
body.theme-light .profile-page .profile-security-metric,
body.theme-light .project-form-premium .transport-fields-grid {
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

body.theme-dark .overview-module-card,
body.theme-dark .projects-page .project-form-v5,
body.theme-dark .projects-page .project-kpi-grid .compact-card,
body.theme-dark .stats-page .stats-kpi-grid .compact-card,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-accent,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-manager,
body.theme-dark .stock-page .switch-link,
body.theme-dark .stats-page .tab,
body.theme-dark .profile-page .profile-security-metric,
body.theme-dark .project-form-premium .pleveles-calc-box,
body.theme-dark .project-form-premium .transport-fields-grid,
body.theme-dark .master-page .material-group-card {
  background: var(--card-elevated-bg) !important;
  color: var(--text);
}

body.theme-dark .master-page .material-group-summary {
  background: var(--group-summary-bg) !important;
}

body.theme-dark .master-page .material-group-title,
body.theme-dark .master-page .material-group-summary .muted-text,
body.theme-dark .master-page .inline-label,
body.theme-dark .master-page .data-table-v5 th,
body.theme-dark .master-page .data-table-v5 td {
  color: var(--text);
}

body.theme-dark .master-page .material-group-summary .muted-text,
body.theme-dark .master-page .inline-label,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-label,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-meta {
  color: var(--muted);
}

body.theme-dark .master-page .material-edit-cell,
body.theme-dark .master-page td[colspan="3"],
body.theme-dark .master-page td[colspan="5"] {
  background: var(--edit-row-bg) !important;
}

body.theme-dark .project-form-premium .transport-help {
  border-color: rgba(255,205,122,.24);
}

body.theme-dark .project-step-title {
  border-color: rgba(101, 166, 255, 0.18);
}

body.theme-dark .project-search-input,
body.theme-dark .project-material-input {
  border-color: var(--line);
}


/* ===== V11 POLISH: contrast and readability ===== */
body.theme-light .profile-page .profile-security-metric {
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  border-color: rgba(31, 95, 168, 0.18);
}

body.theme-dark .profile-page .profile-security-metric {
  background: linear-gradient(180deg, rgba(20, 34, 54, 0.98) 0%, rgba(15, 27, 44, 0.98) 100%) !important;
  border-color: rgba(122, 170, 255, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 14px 26px rgba(0, 0, 0, 0.22);
}

body.theme-dark .profile-page .profile-security-card h3,
body.theme-dark .profile-page .profile-info-card h3,
body.theme-dark .profile-page .profile-settings-card h3,
body.theme-dark .profile-page .profile-entries-panel h3,
body.theme-dark .profile-page .profile-info-card p,
body.theme-dark .profile-page .profile-security-card p,
body.theme-dark .profile-page .profile-info-card strong,
body.theme-dark .profile-page .profile-security-card strong {
  color: var(--text);
}

body.theme-dark .profile-page .profile-info-card .muted-text,
body.theme-dark .profile-page .profile-security-card .muted-text {
  color: #aec1d8;
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-accent,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-manager {
  border-color: rgba(122, 170, 255, 0.16);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.24);
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card::after,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-accent::after,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-card-manager::after {
  background: radial-gradient(circle, rgba(122, 170, 255, 0.18) 0%, rgba(122, 170, 255, 0) 72%);
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-label {
  color: #bed0e5;
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-meta {
  color: #aabed6;
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-value,
body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-value span {
  color: #f4f8ff;
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-manager-name {
  color: #bdf6e8;
  text-shadow: 0 2px 18px rgba(77, 218, 190, 0.08);
}

body.theme-dark .stats-page .stats-kpi-grid .stats-kpi-manager-total {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(189, 246, 232, 0.18);
  color: #bdf6e8;
}

body.theme-light .stats-page .stats-kpi-grid .stats-kpi-label {
  color: #415a73;
}

body.theme-light .stats-page .stats-kpi-grid .stats-kpi-meta {
  color: #5f7994;
}

body.theme-light .stats-page .stats-kpi-grid .stats-kpi-manager-name {
  color: #0d5c50;
}

body.theme-light .stats-page .stats-kpi-grid .stats-kpi-manager-total {
  background: rgba(255, 255, 255, 0.88);
  color: #0d5c50;
}


.idle-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.idle-modal.is-open {
  display: block;
}

.idle-modal__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--sidebar) 68%, transparent);
  backdrop-filter: blur(8px) saturate(120%);
}

.idle-modal__card {
  --idle-card-bg: color-mix(in srgb, var(--surface) 92%, var(--primary-soft));
  --idle-card-line: color-mix(in srgb, var(--line) 78%, var(--primary));
  position: relative;
  overflow: hidden;
  width: min(92vw, 540px);
  margin: 11vh auto 0;
  padding: 26px;
  border-radius: 28px;
  border: 1px solid var(--idle-card-line);
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--primary) 22%, transparent) 0%, transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 97%, var(--primary-soft)) 0%, var(--idle-card-bg) 100%);
  box-shadow:
    0 32px 90px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.idle-modal__glow {
  position: absolute;
  right: -44px;
  top: -44px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--primary) 34%, transparent) 0%, transparent 72%);
  pointer-events: none;
}

.idle-modal__header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.idle-modal__badge,
.idle-modal__countdown-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.03em;
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--primary));
}

.idle-modal__badge {
  color: var(--primary-strong);
  background: color-mix(in srgb, var(--primary-soft) 78%, var(--surface));
}

.idle-modal__countdown-chip {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 82%, var(--primary-soft));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.idle-modal__countdown-chip span {
  margin-right: 6px;
  color: var(--primary-strong);
  font-size: 16px;
}

.idle-modal__icon {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  margin: 18px 0 14px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-strong);
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary-soft) 82%, var(--surface)) 0%, color-mix(in srgb, var(--surface) 88%, var(--primary-soft)) 100%);
  border: 1px solid color-mix(in srgb, var(--line) 72%, var(--primary));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.idle-modal__icon svg {
  width: 28px;
  height: 28px;
}

.idle-modal__title {
  position: relative;
  z-index: 1;
  margin: 0 0 10px;
  font-size: clamp(28px, 3.2vw, 34px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  max-width: 12ch;
}

.idle-modal__text {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  max-width: 44ch;
}

.idle-modal__text strong {
  color: var(--text);
}

.idle-modal__progress {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-3) 70%, var(--line-soft));
  border: 1px solid color-mix(in srgb, var(--line-soft) 82%, var(--primary));
}

.idle-modal__progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary-2) 100%);
  transform-origin: left center;
  animation: idleCountdownBar 5s linear forwards;
}

.idle-modal.is-open .idle-modal__progress-bar {
  animation-duration: 5s;
}

.idle-modal__actions {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.idle-modal__actions .btn {
  min-height: 48px;
  padding-inline: 18px;
  border-radius: 14px;
}

.idle-modal__actions .btn-secondary {
  background: color-mix(in srgb, var(--surface) 86%, var(--surface-2));
  color: var(--text);
  border-color: color-mix(in srgb, var(--line) 76%, var(--primary));
}

body.theme-dark .idle-modal__backdrop {
  background: rgba(3, 8, 18, 0.72);
}

body.theme-dark .idle-modal__card {
  --idle-card-bg: rgba(14, 24, 39, 0.96);
  --idle-card-line: rgba(101, 166, 255, 0.2);
  box-shadow:
    0 36px 100px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

body.theme-dark .idle-modal__badge {
  color: #dbe9ff;
  background: rgba(101, 166, 255, 0.12);
  border-color: rgba(101, 166, 255, 0.18);
}

body.theme-dark .idle-modal__countdown-chip {
  color: #eff6ff;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

body.theme-dark .idle-modal__countdown-chip span,
body.theme-dark .idle-modal__icon {
  color: #9ec5ff;
}

body.theme-dark .idle-modal__icon {
  background: linear-gradient(180deg, rgba(101, 166, 255, 0.12) 0%, rgba(101, 166, 255, 0.06) 100%);
  border-color: rgba(101, 166, 255, 0.18);
}

body.theme-dark .idle-modal__title,
body.theme-dark .idle-modal__text strong {
  color: #f4f8ff;
}

body.theme-dark .idle-modal__text {
  color: #aebfd5;
}

body.theme-dark .idle-modal__progress {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.06);
}

body.theme-dark .idle-modal__actions .btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: #f1f5ff;
  border-color: rgba(255, 255, 255, 0.08);
}

body.idle-lock {
  overflow: hidden;
}

body.idle-lock .app-shell {
  pointer-events: none;
  user-select: none;
}

body.idle-lock .idle-modal,
body.idle-lock .idle-modal * {
  pointer-events: auto;
}

.idle-modal.is-open .idle-modal__card {
  animation: idleModalEnter 220ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.idle-modal:focus {
  outline: none;
}

.idle-modal.is-danger .idle-modal__countdown-chip {
  color: #fff;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8a5b 100%);
  border-color: rgba(255, 107, 107, 0.5);
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.12);
}

.idle-modal.is-danger .idle-modal__countdown-chip span {
  color: #fff;
}

.idle-modal.is-danger .idle-modal__icon {
  color: #fff;
  background: linear-gradient(180deg, rgba(255, 107, 107, 0.9) 0%, rgba(255, 138, 91, 0.86) 100%);
  border-color: rgba(255, 107, 107, 0.45);
  box-shadow: 0 18px 40px rgba(255, 107, 107, 0.24);
}

.idle-modal.is-danger .idle-modal__progress-bar {
  background: linear-gradient(90deg, #ff6b6b 0%, #ff8a5b 100%);
}

.idle-modal.is-open .idle-modal__progress-bar {
  animation-duration: var(--idle-countdown-duration, 5s);
}

.idle-modal__actions .btn:focus-visible,
.idle-modal__actions a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 88%, white);
  outline-offset: 3px;
}

@keyframes idleModalEnter {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.975);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes idleCountdownBar {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 640px) {
  .idle-modal__card {
    width: min(94vw, 540px);
    margin-top: 8vh;
    padding: 22px 18px;
    border-radius: 24px;
  }

  .idle-modal__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .idle-modal__title {
    font-size: 26px;
    max-width: none;
  }

  .idle-modal__actions {
    flex-direction: column;
  }

  .idle-modal__actions .btn {
    width: 100%;
  }
}

/* ===== AUDIT PAGE ===== */
.audit-page .audit-hero-card {
  position: relative;
  overflow: hidden;
}

.audit-page .audit-kpi-grid .compact-card span {
  display: inline-block;
  margin-top: 8px;
}

.audit-page .audit-table-panel {
  overflow: hidden;
}

.audit-page .audit-table {
  min-width: 980px;
}

.audit-page .audit-details-cell {
  max-width: 540px;
  white-space: normal;
  line-height: 1.45;
}

.audit-page .audit-shop-pill,
.audit-page .audit-action-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.audit-page .audit-shop-pill {
  background: var(--surface-2);
  color: var(--text);
}

.audit-page .audit-action-success {
  background: rgba(22, 163, 74, 0.12);
  border-color: rgba(22, 163, 74, 0.24);
  color: #15803d;
}

.audit-page .audit-action-warning {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.24);
  color: #b45309;
}

.audit-page .audit-action-danger {
  background: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.24);
  color: #b91c1c;
}

.audit-page .audit-action-neutral {
  background: rgba(59, 130, 246, 0.1);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--primary);
}

body.theme-dark.audit-page .audit-shop-pill {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.2);
  color: var(--text);
}

body.theme-dark.audit-page .audit-action-success {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.28);
  color: #86efac;
}

body.theme-dark.audit-page .audit-action-warning {
  background: rgba(251, 191, 36, 0.14);
  border-color: rgba(251, 191, 36, 0.24);
  color: #fde68a;
}

body.theme-dark.audit-page .audit-action-danger {
  background: rgba(248, 113, 113, 0.14);
  border-color: rgba(248, 113, 113, 0.24);
  color: #fecaca;
}

body.theme-dark.audit-page .audit-action-neutral {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.22);
  color: #bfdbfe;
}


/* ===== GLOBAL UNIFIED SAAS HEADER ===== */
.unified-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  box-shadow: var(--shadow-soft);
}

.unified-page-main {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.unified-page-eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid rgba(31, 95, 168, 0.16);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.unified-page-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  line-height: 1.04;
  color: var(--text);
  letter-spacing: -0.03em;
}

.unified-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.unified-page-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, 1fr));
  gap: 10px;
  min-width: min(100%, 420px);
}

.unified-page-kpi {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.unified-page-kpi span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.unified-page-kpi strong {
  font-size: 22px;
  line-height: 1;
  color: var(--text);
}

.stats-page .stats-head-main.unified-page-header,
.audit-page .audit-hero-card.unified-page-header,
.projects-page .hero-card.unified-page-header,
.stock-page .hero-card.unified-page-header,
.requests-page .hero-card.unified-page-header {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.stats-page .stats-head-main.unified-page-header::after,
.audit-page .audit-hero-card.unified-page-header::after,
.projects-page .hero-card.unified-page-header::after,
.stock-page .hero-card.unified-page-header::after,
.requests-page .hero-card.unified-page-header::after {
  display: none;
}

.stats-page .stats-head-main.unified-page-header h2,
.audit-page .audit-hero-card.unified-page-header h2,
.projects-page .hero-card.unified-page-header h2,
.stock-page .hero-card.unified-page-header h2,
.requests-page .hero-card.unified-page-header h2,
.master-page .unified-page-header h2,
.overview-page .unified-page-header h2 {
  color: var(--text);
}

.stats-page .stats-head-actions,
.audit-page .hero-actions,
.projects-page .hero-actions,
.stock-page .hero-actions,
.requests-page .hero-actions,
.unified-page-actions {
  position: static;
  z-index: auto;
}

.stats-page .stats-head-actions .btn,
.audit-page .hero-actions .btn,
.projects-page .hero-actions .btn,
.stock-page .hero-actions .btn,
.requests-page .hero-actions .btn,
.unified-page-actions .btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--line);
}

.stats-page .stats-head-actions .btn.btn-primary,
.audit-page .hero-actions .btn.btn-primary,
.projects-page .hero-actions .btn.btn-primary,
.stock-page .hero-actions .btn.btn-primary,
.requests-page .hero-actions .btn.btn-primary,
.unified-page-actions .btn.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
  color: #fff;
  border-color: transparent;
}

.overview-page .overview-hero.unified-page-header,
.master-page .overview-hero.unified-page-header {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border-color: var(--line);
  color: var(--text);
  box-shadow: var(--shadow-soft);
}

.overview-page .overview-hero.unified-page-header::after,
.master-page .overview-hero.unified-page-header::after,
.overview-page .overview-hero .overview-hero-glow,
.master-page .overview-hero .overview-hero-glow {
  display: none;
}

@media (max-width: 1100px) {
  .unified-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .unified-page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .unified-page-kpis {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 700px) {
  .unified-page-header {
    padding: 16px;
    border-radius: 18px;
  }

  .unified-page-title {
    font-size: 28px;
  }

  .unified-page-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .unified-page-actions .btn {
    flex: 1 1 auto;
    justify-content: center;
  }
}


/* ===== GLOBAL HEADER CLEANUP + UNIFIED SECTION RHYTHM ===== */
.overview-page .topbar-left > div,
.projects-page .topbar-left > div,
.stock-page .topbar-left > div,
.stats-page .topbar-left > div,
.requests-page .topbar-left > div,
.audit-page .topbar-left > div {
  display: none;
}

.overview-page .topbar,
.projects-page .topbar,
.stock-page .topbar,
.stats-page .topbar,
.requests-page .topbar,
.audit-page .topbar {
  min-height: 72px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.unified-page-header {
  padding: 24px 28px !important;
  border-radius: 24px !important;
  margin-bottom: 20px !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.unified-page-main {
  display: grid;
  gap: 8px;
}

.unified-page-eyebrow {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  border: 1px solid rgba(31, 95, 168, 0.16);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .02em;
}

.unified-page-title {
  margin: 0 !important;
  font-size: clamp(32px, 4vw, 42px) !important;
  line-height: 1.05 !important;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.unified-page-header .muted-text {
  display: none;
}

.unified-page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.overview-page .section-head-v5,
.projects-page .section-head-v5,
.stock-page .section-head-v5,
.stats-page .section-head-v5,
.requests-page .section-head-v5,
.audit-page .section-head-v5,
.master-page .section-head-v5,
.admin-projects-page .section-head-v5 {
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.overview-page .section-head-v5 h2,
.overview-page .section-head-v5 h3,
.projects-page .section-head-v5 h2,
.projects-page .section-head-v5 h3,
.stock-page .section-head-v5 h2,
.stock-page .section-head-v5 h3,
.stats-page .section-head-v5 h2,
.stats-page .section-head-v5 h3,
.requests-page .section-head-v5 h2,
.requests-page .section-head-v5 h3,
.audit-page .section-head-v5 h2,
.audit-page .section-head-v5 h3,
.master-page .section-head-v5 h2,
.master-page .section-head-v5 h3,
.admin-projects-page .section-head-v5 h2,
.admin-projects-page .section-head-v5 h3 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.overview-page .section-head-v5 .muted-text,
.projects-page .section-head-v5 .muted-text,
.stock-page .section-head-v5 .muted-text,
.stats-page .section-head-v5 .muted-text,
.requests-page .section-head-v5 .muted-text,
.audit-page .section-head-v5 .muted-text,
.master-page .section-head-v5 .muted-text,
.admin-projects-page .section-head-v5 .muted-text {
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.5;
}

.overview-page .section-panel,
.projects-page .section-panel,
.stock-page .section-panel,
.stats-page .section-panel,
.requests-page .section-panel,
.audit-page .section-panel,
.master-page .section-panel,
.admin-projects-page .section-panel {
  border-radius: 22px;
}

@media (max-width: 980px) {
  .unified-page-header {
    padding: 20px 20px !important;
  }

  .unified-page-title {
    font-size: 32px !important;
  }
}

@media (max-width: 700px) {
  .overview-page .topbar,
  .projects-page .topbar,
  .stock-page .topbar,
  .stats-page .topbar,
  .requests-page .topbar,
  .audit-page .topbar {
    min-height: 64px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .unified-page-header {
    padding: 18px 18px !important;
    border-radius: 20px !important;
  }

  .unified-page-title {
    font-size: 28px !important;
  }

  .overview-page .section-head-v5 h2,
  .overview-page .section-head-v5 h3,
  .projects-page .section-head-v5 h2,
  .projects-page .section-head-v5 h3,
  .stock-page .section-head-v5 h2,
  .stock-page .section-head-v5 h3,
  .stats-page .section-head-v5 h2,
  .stats-page .section-head-v5 h3,
  .requests-page .section-head-v5 h2,
  .requests-page .section-head-v5 h3,
  .audit-page .section-head-v5 h2,
  .audit-page .section-head-v5 h3,
  .master-page .section-head-v5 h2,
  .master-page .section-head-v5 h3,
  .admin-projects-page .section-head-v5 h2,
  .admin-projects-page .section-head-v5 h3 {
    font-size: 20px;
  }
}


/* ===== MASTER EXPORT PREMIUM ===== */
.admin-export-shell {
  padding: 26px;
}

.admin-export-head {
  margin-bottom: 18px;
}

.admin-export-filter-form {
  gap: 0;
}

.admin-export-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.admin-export-filter-field select {
  min-height: 52px;
  border-radius: 16px;
  border-color: rgba(31, 95, 168, 0.16);
  background: var(--card-elevated-bg);
}

.admin-export-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
}

.admin-export-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(31, 95, 168, 0.14);
  font-size: 13px;
  font-weight: 700;
}

.admin-export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin-top: 22px;
}

.admin-export-card {
  display: grid;
  align-content: space-between;
  gap: 18px;
  min-height: 250px;
  padding: 26px;
  border-radius: 24px;
  background: var(--card-elevated-bg);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.admin-export-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.11);
  border-color: rgba(31, 95, 168, 0.22);
}

.admin-export-card-top {
  display: grid;
  gap: 10px;
}

.admin-export-card-kicker {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(31, 95, 168, 0.14);
  font-size: 12px;
  font-weight: 800;
}

.admin-export-card h4 {
  margin: 0;
  font-size: 28px;
  line-height: 1.08;
}

.admin-export-card .muted-text {
  font-size: 15px;
  line-height: 1.65;
}

.admin-export-btn-wrap {
  margin-top: auto;
}

.admin-export-btn {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  font-size: 15px;
  font-weight: 800;
}

.page-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(10, 18, 34, 0.34);
  backdrop-filter: blur(6px);
}

.page-loading-overlay.is-active {
  display: flex;
}

.page-loading-card {
  width: min(92vw, 360px);
  padding: 24px 22px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: linear-gradient(180deg, rgba(15,39,71,.98) 0%, rgba(19,52,95,.98) 100%);
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  color: #fff;
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.page-loading-spinner {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.18);
  border-top-color: #ffffff;
  animation: pageSpin 0.85s linear infinite;
}

.page-loading-text {
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,.94);
}

@keyframes pageSpin {
  to { transform: rotate(360deg); }
}

@media (max-width: 1180px) {
  .admin-export-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .admin-export-filter-grid {
    grid-template-columns: 1fr;
  }
}
.shop-option:hover .shop-icon svg {
  filter:
    drop-shadow(0 0 8px rgba(87, 126, 191, 0.24))
    drop-shadow(0 0 18px rgba(130, 166, 223, 0.18));
}
