/**
 * PSM Pro — Frontend Design System v3.4.0
 * Dark industrial theme — precise, confident, fuel-station grade
 */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Unbounded:wght@400;600;700;900&display=swap');

:root {
  --fe-font: 'Space Grotesk', sans-serif;
  --fe-mono: 'JetBrains Mono', monospace;
  --fe-display: 'Unbounded', sans-serif;

  --bg: #0a0d12;
  --surface: #111620;
  --card: #161d2a;
  --border: #232d3e;
  --border2: #2e3d54;
  --accent: #e8a020;
  --accent2: #3b9eff;
  --text: #e2e8f0;
  --muted: #64748b;
  --muted2: #94a3b8;
  --red: #ef4444;
  --green: #22c55e;
  --purple: #a78bfa;

  --sidebar-w: 248px;
  --sidebar-bg: #0c1118;
  --sidebar-border: #161e2a;
  --input-bg: #111820;
  --input-border: #1e2d3d;
  --glow-gold: 0 0 24px rgba(232, 160, 32, .15);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .6);
}

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

.psm-fe,
.psm-login-page {
  font-family: var(--fe-font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.psm-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

.psm-main {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}

.psm-content {
  padding: 0;
  /* Remove padding here, handled by .psmp-wrap */
  width: 100%;
  max-width: 100%;
  margin: 0;
}

/* Sidebar */
.psm-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  color: white;
}

.psm-brand {
  padding: 24px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
  gap: 12px;
}

.psm-sidebar-logo {
  width: 80px;
  height: auto;
  display: block;
  filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.5));
}

.psm-sidebar-station-name {
  font-family: var(--fe-display);
  font-size: .85rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: .5px;
  line-height: 1.3;
}



.psm-owner-badge {
  margin: 10px 12px 4px;
  padding: 6px 10px;
  background: rgba(59, 130, 246, .08);
  border: 1px solid rgba(59, 130, 246, .2);
  border-radius: 6px;
  font-family: var(--fe-mono);
  font-size: .68rem;
  font-weight: 600;
  color: #60a5fa;
  text-align: center;
  letter-spacing: .5px;
}

.psm-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.psm-nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  border-radius: 8px;
  color: var(--muted2);
  text-decoration: none;
  font-size: .84rem;
  font-weight: 500;
  transition: background .15s, color .15s;
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.psm-nav-item:hover {
  background: rgba(255, 255, 255, .04);
  color: var(--text);
}

.psm-nav-item.active {
  background: rgba(232, 160, 32, .1);
  color: var(--accent);
}

.psm-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.psm-nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: .65;
}

.psm-nav-item:hover .psm-nav-icon,
.psm-nav-item.active .psm-nav-icon {
  opacity: 1;
}

.psm-user {
  padding: 12px 14px;
  border-top: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, .02);
}

.psm-user-avatar {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, var(--accent2), #6366f1);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--fe-mono);
  font-weight: 700;
  font-size: .72rem;
  color: #fff;
  flex-shrink: 0;
}

.psm-user-info {
  flex: 1;
  min-width: 0;
}

.psm-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.psm-user-role {
  font-family: var(--fe-mono);
  font-size: .66rem;
  color: var(--muted);
  margin-top: 2px;
}

.psm-logout-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: .9rem;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}

.psm-logout-btn:hover {
  background: rgba(239, 68, 68, .1);
  color: var(--red);
}

/* Page Header */
.fe-hdr {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.fe-hdr h1 {
  font-family: var(--fe-display);
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--text);
  margin: 0;
  line-height: 1.1;
}

.fe-sub {
  font-family: var(--fe-mono);
  font-size: .76rem;
  color: var(--muted);
  margin: 5px 0 0;
}

.fe-hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}


/* Unique Stat Card Overrides */
.stat-card {
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), transparent);
}

.stat-card.green::after {
  background: linear-gradient(90deg, var(--green), transparent);
}

.stat-card.blue::after {
  background: linear-gradient(90deg, var(--accent2), transparent);
}

.stat-card.red::after {
  background: linear-gradient(90deg, var(--red), transparent);
}

.stat-card.purple::after {
  background: linear-gradient(90deg, var(--purple), transparent);
}


/* Premium Loader */
.loader {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-family: var(--fe-mono);
  font-size: .8rem;
}

.loader::before {
  content: '';
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 0 auto 10px;
}

/* Shift status */
.shift-status-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--card);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.shift-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.shift-dot.open {
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  animation: pulse 2s ease-in-out infinite;
}

.shift-dot.closed {
  background: var(--muted);
}

@keyframes pulse {

  0%,
  100% {
    box-shadow: 0 0 4px var(--green);
  }

  50% {
    box-shadow: 0 0 14px var(--green);
  }
}

/* ══ LOGIN PAGE ══ */
.psm-login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background: var(--bg);
  font-family: var(--fe-font);
}

.psm-login-outer {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.psm-login-brand {
  text-align: center;
}

.psm-login-logo-img {
  width: 200px;
  height: auto;
  display: block;
  margin: 0 auto;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.5));
}

.psm-login-card {
  width: 100%;
  background: var(--card);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.psm-login-hero {
  width: 100%;
  height: 180px;
  overflow: hidden;
  position: relative;
}

.psm-login-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(.8) saturate(.85);
}

.psm-login-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: linear-gradient(to top, var(--card), transparent);
}

.psm-login-body {
  padding: 28px 32px 24px;
}

.psm-login-welcome {
  margin-bottom: 22px;
}

.psm-login-welcome h3 {
  font-family: var(--fe-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
  letter-spacing: -.2px;
}

.psm-login-welcome p {
  font-size: 0.82rem;
  color: var(--muted2);
  margin: 6px 0 0;
  line-height: 1.5;
}

.psm-login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(239, 68, 68, .1);
  border: 1px solid rgba(239, 68, 68, .25);
  border-radius: 6px;
  padding: 11px 14px;
  color: var(--red);
  font-size: .82rem;
  margin-bottom: 18px;
}

.psm-login-form .field {
  margin-bottom: 18px;
}

.psm-login-form .field label {
  display: block;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon svg {
  position: absolute;
  left: 13px;
  color: var(--muted);
  pointer-events: none;
  flex-shrink: 0;
}

.input-with-icon input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  padding: 11px 14px 11px 42px;
  font-size: 0.88rem;
  border-radius: 6px;
  transition: border-color .2s, box-shadow .2s;
  color: var(--text);
  font-family: var(--fe-font);
  outline: none;
}

.input-with-icon input:focus {
  border-color: var(--accent2);
  box-shadow: 0 0 0 3px rgba(59, 158, 255, .1);
}

.input-with-icon input::placeholder {
  color: var(--muted);
  opacity: .45;
}

.input-with-icon .toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
  width: 32px;
  height: 32px;
  z-index: 10;
}

.input-with-icon .toggle-pwd svg {
  position: static;
  pointer-events: none;
}

.input-with-icon .toggle-pwd:hover {
  color: var(--text);
}


.psm-login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.remember-me input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.remember-me span {
  font-size: 0.8rem;
  color: var(--muted2);
  font-weight: 500;
}

.forgot-pwd {
  font-size: 0.8rem;
  color: var(--accent2);
  font-weight: 600;
  text-decoration: none;
  transition: color .15s;
}

.forgot-pwd:hover {
  color: #5aabff;
}

.btn-login-main {
  background: var(--accent);
  color: #000;
  font-family: var(--fe-display);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 13px 24px;
  border-radius: 8px;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  letter-spacing: .4px;
}

.btn-login-main:hover {
  background: #f5ae30;
  transform: translateY(-1px);
  box-shadow: var(--glow-gold);
}

.psm-login-card-ftr {
  background: var(--surface);
  padding: 14px 32px;
  text-align: center;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--muted);
}

.psm-login-card-ftr strong {
  color: var(--accent2);
  cursor: pointer;
  font-weight: 600;
}

.psm-login-status-bar {
  display: flex;
  gap: 20px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

/* Owner */
.psm-owner .btn-add,
.psm-owner .btn-edit,
.psm-owner .btn-delete,
.psm-owner .btn-write,
.psm-owner .btn-save,
.psm-owner form.write-form {
  display: none !important;
}

/* Utilities */
.text-gold {
  color: var(--accent);
}

.text-green {
  color: var(--green);
}

.text-red {
  color: var(--red);
}

.text-blue {
  color: var(--accent2);
}

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

.text-mono {
  font-family: var(--fe-mono);
}

.fw600 {
  font-weight: 600;
}

.fw700 {
  font-weight: 700;
}

.fs-sm {
  font-size: .8rem;
}

.fs-xs {
  font-size: .72rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border2);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* Tablet */
@media (max-width: 900px) {
  :root {
    --sidebar-w: 64px;
  }

  .psm-brand-name,
  .psm-brand-ver,
  .psm-nav-item span:not(.psm-nav-icon),
  .psm-user-info,
  .psm-owner-badge {
    display: none;
  }

  .psm-brand {
    justify-content: center;
    padding: 18px 0;
  }

  .psm-nav {
    padding: 14px 8px;
  }

  .psm-nav-item {
    justify-content: center;
    padding: 12px 0;
  }

  .psm-user {
    justify-content: center;
    padding: 12px 0;
  }

  .psm-content {
    padding: 20px 24px;
  }

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

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

/* Mobile */
@media (max-width: 600px) {
  .psm-layout {
    flex-direction: column-reverse;
  }

  .psm-sidebar {
    width: 100%;
    height: 60px;
    min-width: unset;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    flex-direction: row;
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 200;
  }

  .psm-brand,
  .psm-user,
  .psm-owner-badge {
    display: none;
  }

  .psm-nav {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    padding: 0 4px;
    gap: 0;
  }

  .psm-nav-item {
    flex-direction: column;
    gap: 3px;
    font-size: .6rem;
    padding: 8px 6px;
    flex: 1;
    justify-content: center;
  }

  .psm-nav-item span:not(.psm-nav-icon) {
    display: block;
  }

  .psm-nav-icon {
    font-size: 1.2rem;
    width: auto;
  }

  .psm-main {
    padding-bottom: 30px;
  }

  .psm-content {
    padding: 16px;
  }

  .fe-hdr h1 {
    font-size: 1.4rem;
  }

  .fe-hdr {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .g4,
  .g3,
  .g2 {
    grid-template-columns: 1fr 1fr;
  }

  .psm-login-hdr {
    padding: 32px 24px 20px;
  }

  .psm-login-body {
    padding: 0 24px 32px;
  }

  .psm-login-ftr {
    padding: 16px 24px;
  }

  .stat-val {
    font-size: 1.4rem;
  }

  .psm-modal {
    border-radius: 14px 14px 0 0;
    margin-top: auto;
    max-width: 100%;
  }

  .psm-modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .psm-tabs {
    padding: 0 12px;
  }

  .psm-tab-btn {
    padding: 12px;
    font-size: .78rem;
  }
}

/* Footer */
.psm-footer {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.psm-footer-content {
  font-family: var(--fe-mono);
  font-size: .7rem;
  color: var(--muted);
  text-align: center;
  letter-spacing: .5px;
}

.psm-login-copyright {
  margin-top: 12px;
  font-family: var(--fe-mono);
  font-size: .68rem;
  color: var(--muted);
  text-align: center;
  opacity: .6;
  letter-spacing: .5px;
}