:root {
  --bg: #09111f;
  --bg-soft: #101c2d;
  --panel: #121f2d;
  --panel-alt: #16293a;
  --primary: #58c5a7;
  --primary-dark: #2b9a82;
  --text: #edf6ff;
  --muted: #9fb5c8;
  --border: rgba(159, 181, 200, 0.18);
  --success: #7ee0a7;
  --danger: #ff8c8c;
  --warning: #ffd27d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, #0a1626 100%);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    repeating-linear-gradient(
      0deg,
      rgba(88, 197, 167, 0.08) 0px,
      rgba(88, 197, 167, 0.08) 1px,
      transparent 1px,
      transparent 80px
    ),
    repeating-linear-gradient(
      90deg,
      rgba(0, 102, 204, 0.08) 0px,
      rgba(0, 102, 204, 0.08) 1px,
      transparent 1px,
      transparent 80px
    );
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(circle at 10% 20%, rgba(88, 197, 167, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(0, 102, 204, 0.12) 0%, transparent 40%);
  animation: techGlow 6s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
}

@keyframes techGlow {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(9, 17, 31, 0.82);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-logo {
  width: 44px;
  height: 44px;
  display: block;
}
.brand-text {
  line-height: 1;
}
.brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06rem;
}
.brand-sub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 2px;
}
nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

nav a {
  color: var(--muted);
  text-decoration: none;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1rem 3rem;
  position: relative;
  z-index: 1;
}

.flash-container {
  margin-bottom: 1.5rem;
}

.flash {
  padding: 0.9rem 1rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
}

.flash-success {
  background: rgba(126, 224, 167, 0.14);
  color: var(--success);
}

.flash-error {
  background: rgba(255, 140, 140, 0.12);
  color: var(--danger);
}

.welcome-wrap {
  display: flex;
  justify-content: center;
  padding-top: 2rem;
}

.welcome-card,
.panel {
  background: rgba(18, 31, 45, 0.96);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
  position: relative;
  z-index: 1;
}

.welcome-card {
  width: min(100%, 700px);
}

.small-card {
  width: min(100%, 450px);
}

h1, h2 {
  margin: 0;
}

.eyebrow {
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08rem;
  font-size: 0.72rem;
  margin-bottom: 0.65rem;
}

.subtitle {
  color: var(--muted);
  margin: 0.8rem 0 1.25rem;
}

.lookup-form,
.stacked-form,
.inline-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  color: var(--muted);
}

input, button, select, textarea {
  border-radius: 12px;
  font: inherit;
}

input, select, textarea {
  width: 100%;
  background: rgba(9, 17, 31, 0.9);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.8rem 0.9rem;
}

input::placeholder {
  color: var(--muted);
}

button,
.primary-button,
.secondary-button,
.danger-button {
  padding: 0.8rem 1rem;
  border: none;
  font-weight: 700;
  cursor: pointer;
}

.primary-button {
  background: var(--primary);
  color: #062317;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.secondary-button {
  background: #dfe9f5;
  color: #102334;
}

.danger-button {
  background: #ffd1d1;
  color: #430d0d;
}

.small-button {
  padding: 0.55rem 0.7rem;
  font-size: 0.82rem;
}

.message {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  font-weight: 600;
}

.message-error {
  background: rgba(255, 140, 140, 0.12);
  border: 1px solid rgba(255, 140, 140, 0.3);
  color: var(--danger);
}

.role-panel {
  margin-top: 1.2rem;
  background: rgba(19, 41, 58, 0.8);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.role-grid div {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.role-grid span {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.page-header {
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.download-link {
  margin-top: 1rem;
}

.download-link a {
  color: var(--primary);
  text-decoration: none;
}

.table-panel {
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

th, td {
  text-align: left;
  padding: 0.8rem 0.6rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.link-row {
  margin-top: 1rem;
}

.link-row a {
  color: var(--primary);
  text-decoration: none;
}

.actions-cell {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.scan-actions {
  display: flex;
  gap: 0.75rem;
}

.scan-actions button {
  flex: 1;
}

.active-panel {
  margin-top: 1.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 1rem;
  margin: 1rem 0 1.5rem;
}

.stat-card {
  background: rgba(18, 31, 45, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Dashboard layout improvements */
.dashboard-main {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: start;
}

.left-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.right-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chart-panel {
  width: 100%;
  height: 360px;
  padding: 8px 12px;
}

.chart-panel canvas {
  width: 100% !important;
  height: 100% !important;
}

.shift-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.shift-card {
  background: rgba(18, 31, 45, 0.9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
}

.shift-card h4 {
  margin: 0 0 6px 0;
}

.mini-chart { height: 140px; }
.mini-chart canvas { width:100% !important; height:100% !important; }

@media (max-width: 960px) {
  .dashboard-main { grid-template-columns: 1fr; }
  .shift-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .shift-grid { grid-template-columns: 1fr; }
}
.stat-card span {
  color: var(--muted);
}

.stat-card strong {
  font-size: 2rem;
}

.success {
  border-color: rgba(88, 197, 167, 0.45);
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(18, 31, 45, 0.7);
}

.list li > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.compact-list li {
  padding: 0.7rem 0.8rem;
}

small {
  color: var(--muted);
}

.dashboard-grid {
  align-items: start;
}

@media (max-width: 760px) {
  .two-column,
  .role-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .panel-header,
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  nav {
    flex-wrap: wrap;
    gap: 0.7rem;
  }
}
