:root {
  --navy: #135164;
  --navy-dark: #09666b;
  --navy-light: #1e3a5f;
  --navy-soft: #143a5f;
  --amber: #f5a623;
  --amber-light: #fff8e7;
  --amber-soft: #fef3c7;
  --amber-dark: #d97706;
  --green: #00c853;
  --green-light: #e8f5e9;
  --green-soft: #dcfce7;
  --green-dark: #009624;
  --red: #ef4444;
  --red-light: #fee2e2;
  --red-soft: #fecaca;
  --red-dark: #b91c1c;
  --blue: #3b82f6;
  --blue-light: #dbeafe;
  --blue-soft: #bfdbfe;
  --blue-dark: #1e40af;
  --orange: #f97316;
  --orange-light: #ffedd5;
  --orange-soft: #fed7aa;
  --purple: #8b5cf6;
  --purple-light: #ede9fe;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --text: #0f172a;
  --text-secondary: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --shadow-sm: 0 1px 2px rgba(10, 37, 64, 0.04);
  --shadow: 0 1px 3px rgba(10, 37, 64, 0.06), 0 2px 8px rgba(10, 37, 64, 0.04);
  --shadow-lg:
    0 4px 16px rgba(10, 37, 64, 0.08), 0 8px 32px rgba(10, 37, 64, 0.06);
  --shadow-xl: 0 12px 40px rgba(10, 37, 64, 0.12);
  --sidebar-width: 280px;
  --topbar-height: 68px;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
html {
  scroll-behavior: smooth;
}
.entry-item:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
  border-radius: 0;
}
.sidebar-item:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}
.bottom-item:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -2px;
}
.checkbox-item:focus-within {
  border-color: var(--amber);
  background: var(--amber-light);
}

.hidden {
  display: none !important;
}
.flex {
  display: flex;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-center {
  justify-content: center;
}
.gap-1 {
  gap: 0.5rem;
}
.gap-2 {
  gap: 1rem;
}
.w-full {
  width: 100%;
}
.text-center {
  text-align: center;
}
.text-sm {
  font-size: 0.875rem;
}
.text-xs {
  font-size: 0.75rem;
}
.font-semibold {
  font-weight: 600;
}
.font-bold {
  font-weight: 700;
}
.text-muted {
  color: var(--muted);
}
.mt-1 {
  margin-top: 0.5rem;
}
.mt-2 {
  margin-top: 1rem;
}
.mb-1 {
  margin-bottom: 0.5rem;
}
.mb-2 {
  margin-bottom: 1rem;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(245, 166, 35, 0.35);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(245, 166, 35, 0);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
@keyframes skeleton {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

.animate-fade {
  animation: fadeIn 0.4s ease-out;
}
.animate-shake {
  animation: shake 0.3s ease-in-out;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1;
  position: relative;
  overflow: hidden;
  outline: none;
}
.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.4);
}
.btn:active {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}
.btn-primary {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-soft) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(10, 37, 64, 0.15);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--navy-light) 0%, var(--navy) 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(10, 37, 64, 0.2);
}
.btn-success {
  background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 200, 83, 0.15);
}
.btn-success:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 200, 83, 0.2);
}
.btn-warning {
  background: linear-gradient(135deg, var(--orange) 0%, #ea580c 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(249, 115, 22, 0.15);
}
.btn-warning:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}
.btn-danger {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}
.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--bg);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  color: #94a3b8;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}
.btn-block {
  width: 100%;
}
.btn-loading::after {
  content: "";
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 6px;
}

.form-group {
  margin-bottom: 1.25rem;
}
.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.form-control {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.9375rem;
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
  appearance: none;
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.12);
}
.form-control:read-only {
  background: var(--bg);
  color: var(--muted);
}
.form-control:disabled {
  background: var(--border-light);
  opacity: 0.7;
  cursor: not-allowed;
}
.form-control.error {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}
select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}
.form-hint {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.25rem;
}
.form-error {
  font-size: 0.8rem;
  color: var(--red);
  margin-top: 0.375rem;
  font-weight: 600;
  display: none;
}
.form-error.show {
  display: block;
}

/* ===== LOGIN THEME ===== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a2540 0%, #1e3a5f 40%, #0f172a 100%);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}
.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      circle at 20% 30%,
      rgba(245, 166, 35, 0.1) 0%,
      transparent 50%
    ),
    radial-gradient(
      circle at 80% 70%,
      rgba(59, 130, 246, 0.08) 0%,
      transparent 50%
    );
  pointer-events: none;
}
.login-card {
  background: rgba(255, 255, 255, 0.98);
  width: 100%;
  max-width: 460px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
  z-index: 1;
  animation: cardSlideUp 0.5s ease-out;
  backdrop-filter: blur(20px);
}
@keyframes cardSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.login-header {
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  padding: 2.5rem 2rem 1.5rem;
  text-align: center;
  position: relative;
}
.login-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 48px;
  height: 4px;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  border-radius: 2px;
}
.login-logo-container {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--amber), var(--orange));
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 8px 24px rgba(245, 166, 35, 0.3);
  font-size: 1.75rem;
  font-weight: 900;
  color: #fff;
}
.login-header h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.02em;
}
.login-header p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
  font-weight: 500;
}
.login-body {
  padding: 2rem;
}
.login-input-group {
  position: relative;
  margin-bottom: 1.25rem;
}
.login-input-group input {
  width: 100%;
  padding: 0.875rem 1rem 0.875rem 2.75rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  transition: var(--transition);
}
.login-input-group input:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 4px rgba(245, 166, 35, 0.1);
}
.login-input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--muted);
  pointer-events: none;
  transition: color 0.2s;
}
.login-input-group input:focus + .login-input-icon {
  color: var(--amber);
}
.login-btn {
  width: 100%;
  padding: 0.875rem;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(10, 37, 64, 0.2);
  margin-top: 0.5rem;
}
.login-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(10, 37, 64, 0.3);
}
.login-btn:active {
  transform: translateY(0);
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  color: var(--muted);
  font-size: 0.8rem;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.login-error-box {
  background: var(--red-light);
  border: 1px solid var(--red-soft);
  border-radius: var(--radius-xs);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  animation: fadeIn 0.2s ease;
}
.login-error-box.show {
  display: flex;
}
.login-error-box .icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.login-error-box .text {
  font-size: 0.85rem;
  color: var(--red-dark);
  font-weight: 600;
  line-height: 1.4;
}
.login-info-box {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 1px solid var(--blue-soft);
  border-radius: var(--radius-xs);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
  display: none;
  align-items: flex-start;
  gap: 0.5rem;
  animation: fadeIn 0.2s ease;
}
.login-info-box.show {
  display: flex;
}
.login-info-box .icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  color: var(--blue);
}
.login-info-box .text {
  font-size: 0.85rem;
  color: var(--blue-dark);
  font-weight: 600;
  line-height: 1.4;
}
.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.login-footer a {
  color: var(--amber);
  font-weight: 700;
  text-decoration: none;
}
.login-footer a:hover {
  text-decoration: underline;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-height);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}
.topbar-brand img {
  height: 36px;
  background: #fff;
  padding: 3px 6px;
  border-radius: 4px;
}
.topbar-brand h1 {
  font-size: 1.1rem;
  font-weight: 800;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.badge-plant {
  background: var(--amber);
  color: var(--navy);
  box-shadow: 0 2px 6px rgba(245, 166, 35, 0.2);
}
.badge-role {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  backdrop-filter: blur(4px);
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.75rem;
  z-index: 90;
  overflow-y: auto;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin: 0.25rem 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  border-left: 3px solid transparent;
  position: relative;
}
.sidebar-item:hover {
  background: var(--bg);
  color: var(--navy);
}
.sidebar-item.active {
  background: linear-gradient(135deg, var(--amber-light), var(--amber-soft));
  color: var(--navy);
  border-left-color: var(--amber);
}
.sidebar-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 1rem;
}
.sidebar-footer {
  margin-top: auto;
  padding: 1rem;
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--border);
  display: none;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom, 0);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(12px);
}
.bottom-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 100%;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-top: 3px solid transparent;
  transition: var(--transition);
  cursor: pointer;
  padding-top: 2px;
}
.bottom-item.active {
  color: var(--navy);
  border-top-color: var(--amber);
}
.bottom-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  min-height: calc(100vh - var(--topbar-height));
  padding: 2rem;
  animation: fadeIn 0.3s ease-out;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
#viewAnalysis .cards-grid {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 1200px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  #viewAnalysis .cards-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
.status-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-light);
  position: relative;
  overflow: hidden;
}
.status-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.status-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border);
}
.status-card.active-card::before {
  background: linear-gradient(90deg, var(--blue), var(--purple));
  opacity: 1;
}
.status-card.pending-card::before {
  background: linear-gradient(90deg, var(--orange), var(--red));
  opacity: 1;
}
.status-card.process-card::before {
  background: linear-gradient(90deg, var(--amber), var(--orange));
  opacity: 1;
}
.status-card.completed-card::before {
  background: linear-gradient(90deg, var(--green), #00b248);
  opacity: 1;
}
.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.card-title {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.card-icon {
  font-size: 1.5rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}
.card-count {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--navy);
  line-height: 1;
  letter-spacing: -0.02em;
}
.card-footer {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.5rem;
  font-weight: 500;
}
.card-trend {
  font-size: 0.75rem;
  font-weight: 700;
  margin-top: 0.25rem;
}
.card-trend.up {
  color: var(--green);
}
.card-trend.down {
  color: var(--red);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.section-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
  letter-spacing: -0.01em;
}
.entry-list {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border-light);
}
.entry-item {
  padding: 1.125rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: var(--transition);
  gap: 1rem;
}
.entry-item:last-child {
  border-bottom: none;
}
.entry-item:hover {
  background: var(--bg);
}
.entry-item:active {
  background: var(--amber-light);
}
.entry-meta {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
  flex: 1;
}
.entry-id {
  font-weight: 800;
  color: var(--navy);
  font-size: 0.95rem;
}
.entry-desc {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-tags {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: 0.375rem;
}
.entry-tag {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--navy-light);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.entry-plant {
  font-size: 0.75rem;
  color: var(--orange);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.entry-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}
.entry-status {
  padding: 0.35rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.status-my-request {
  background: var(--blue-light);
  color: var(--blue-dark);
}
.status-pending {
  background: var(--orange-light);
  color: #9a3412;
}
.status-liquidation {
  background: var(--amber-soft);
  color: #92400e;
}
.status-completed {
  background: var(--green-light);
  color: var(--green-dark);
}
.status-rejected {
  background: var(--red-light);
  color: var(--red-dark);
}

.form-container {
  max-width: 900px;
  margin: 0 auto;
  background: var(--surface);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  animation: fadeIn 0.3s ease-out;
}
.form-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 3px solid var(--amber);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
.form-full {
  grid-column: 1 / -1;
}
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  background: var(--surface);
  transition: var(--transition);
}
.checkbox-item:hover {
  border-color: var(--amber);
  background: var(--amber-light);
}
.checkbox-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--amber);
  flex-shrink: 0;
  cursor: pointer;
}
.checkbox-item label {
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
}
.others-input {
  margin-top: 0.5rem;
  margin-left: 1.625rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}
.detail-main {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  border: 1px solid var(--border-light);
  animation: fadeIn 0.3s ease-out;
}
.detail-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.tracker-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  border: 1px solid var(--border-light);
}
.tracker-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.tracker-step {
  display: flex;
  gap: 0.875rem;
  position: relative;
  padding-bottom: 1.5rem;
}
.tracker-step:last-child {
  padding-bottom: 0;
}
.tracker-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 32px;
  width: 2px;
  height: calc(100% - 12px);
  background: var(--border-light);
}
.tracker-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  flex-shrink: 0;
  z-index: 1;
  color: #fff;
  font-weight: 700;
  transition: var(--transition);
}
.tracker-dot.done {
  background: var(--green);
  box-shadow: 0 2px 8px rgba(0, 200, 83, 0.25);
}
.tracker-dot.active {
  background: var(--orange);
  animation: pulse 2s infinite;
}
.tracker-info h4 {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text);
}
.tracker-info p {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}
.tracker-time {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.25rem;
  font-weight: 500;
}
.tracker-progress {
  height: 4px;
  background: var(--border-light);
  border-radius: 2px;
  margin-bottom: 1.5rem;
  overflow: hidden;
}
.tracker-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--amber), var(--orange));
  border-radius: 2px;
  transition: width 0.5s ease;
}

.signature-box {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xs);
  padding: 1.25rem;
  text-align: center;
  background: var(--bg);
  transition: var(--transition);
}
.signature-box:hover {
  border-color: var(--amber);
  background: var(--amber-light);
}
.signature-canvas {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: crosshair;
  width: 100%;
  height: 180px;
  touch-action: none;
}
.signature-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.75rem;
  font-weight: 500;
}
.signature-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.75rem;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.5);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(6px);
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalIn 0.3s ease;
  border: 1px solid var(--border-light);
}
@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
}
.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--navy);
}
.modal-body {
  padding: 1.5rem;
}
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-light);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  background: var(--bg);
}

.archive-filters {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  flex: 1;
  min-width: 160px;
}
.filter-group label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.print-area {
  display: none;
}
@page {
  margin: 0;
  size: auto;
}
@media print {
  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    height: 100%;
  }
  body * {
    visibility: hidden;
  }
  .print-area,
  .print-area * {
    visibility: visible;
  }
  .print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    display: block !important;
    margin: 0;
    padding: 0;
  }
  .no-print,
  .topbar,
  .sidebar,
  .bottom-nav,
  .debug-toggle,
  .debug-panel {
    display: none !important;
  }
}
.print-form {
  border: none;
  padding: 0.75rem 1rem;
  max-width: 100%;
  margin: 0 auto;
  background: #fff;
  font-family: "Century Gothic", Arial, sans-serif;
  box-sizing: border-box;
}
.print-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1.5px solid #000;
  padding-bottom: 0.5rem;
  margin-bottom: 0.75rem;
}
.print-header-left {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
}
.print-header-center {
  text-align: center;
}
.print-header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  text-align: right;
}
.print-logo {
  height: 40px;
}
.print-title {
  text-align: left;
  font-size: 16pt;
  font-weight: 800;
  text-transform: uppercase;
  font-family: "Century Gothic", Arial, sans-serif;
}
.print-meta {
  text-align: left;
  font-size: 9pt;
  font-family: "Century Gothic", Arial, sans-serif;
  font-weight: 700;
}
.print-entry-number {
  font-family: "Century Gothic", Arial, sans-serif;
  font-size: 9pt;
  font-weight: 700;
  margin-top: 0.25rem;
  color: #000;
}
.print-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}
.print-field {
  flex: 1;
  border-bottom: 1px solid #333;
  padding-bottom: 0.15rem;
}
.print-field label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.15rem;
}
.print-field-value {
  font-size: 0.85rem;
  min-height: 1.1rem;
}
.print-checkboxes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  margin: 0.5rem 0;
}
.print-check-item {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
}
.print-check-box {
  width: 12px;
  height: 12px;
  border: 1px solid #000;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.print-check-box.checked::after {
  content: "✓";
  font-weight: bold;
  font-size: 0.65rem;
}
.print-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1.5px solid #000;
  padding-top: 0.75rem;
}
.print-sig-box {
  text-align: center;
}
.print-sig-line {
  border-bottom: 1px solid #000;
  height: 64px;
  margin-bottom: 0.3rem;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.print-sig-line img {
  max-height: 38px;
}
.print-sig-label {
  font-size: 0.65rem;
  font-weight: 700;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
    padding: 1rem;
    margin-bottom: 80px;
  }
  .bottom-nav {
    display: flex;
  }
  .topbar h1 {
    display: none;
  }
  .cards-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.875rem;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
  .detail-layout {
    grid-template-columns: 1fr;
  }
  .archive-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-group {
    min-width: 100%;
  }
  .entry-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .entry-right {
    width: 100%;
    justify-content: space-between;
  }
  .login-card {
    max-width: 100%;
    border-radius: var(--radius-sm);
  }
  .login-body {
    padding: 1.5rem;
  }
  .login-header {
    padding: 2rem 1.5rem 1.25rem;
  }
}
@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr;
  }
  .btn {
    font-size: 0.875rem;
    padding: 0.625rem 1rem;
  }
  .form-container {
    padding: 1.25rem;
  }
  .detail-main {
    padding: 1.25rem;
  }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.92);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 300;
  backdrop-filter: blur(4px);
}
.loading-overlay.active {
  display: flex;
}
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.loading-text {
  margin-top: 1rem;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 600;
}

.toast {
  position: fixed;
  top: 80px;
  right: 20px;
  padding: 1rem 1.5rem;
  border-radius: var(--radius-xs);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  z-index: 400;
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  max-width: 380px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.toast.show {
  transform: translateX(0);
}
.toast-success {
  background: linear-gradient(135deg, var(--green), var(--green-dark));
}
.toast-error {
  background: linear-gradient(135deg, var(--red), var(--red-dark));
}
.toast-info {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
}
.toast-warning {
  background: linear-gradient(135deg, var(--orange), #ea580c);
}
.toast-icon {
  font-size: 1.1rem;
}

.debug-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 500;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--shadow-lg);
  transition: var(--transition);
}
.debug-toggle:hover {
  transform: scale(1.1);
  background: var(--navy-light);
}
.debug-panel {
  position: fixed;
  bottom: 72px;
  right: 20px;
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-xs);
  font-size: 0.75rem;
  font-family: ui-monospace, SFMono-Regular, monospace;
  max-width: 480px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 500;
  display: none;
  box-shadow: var(--shadow-xl);
  border: 1px solid #334155;
}
.debug-panel.show {
  display: block;
  animation: slideInRight 0.2s ease;
}
.debug-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #334155;
  font-weight: 700;
  color: #fff;
}
.debug-panel-close {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.debug-panel-close:hover {
  color: #fff;
}
.debug-entry {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #334155;
  line-height: 1.4;
}
.debug-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.debug-time {
  color: var(--amber);
  font-weight: 700;
}
.debug-error {
  color: #f87171;
}
.debug-success {
  color: #4ade80;
}

.empty-state {
  padding: 4rem 2rem;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
}
.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.4;
}
.empty-state-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.confirm-dialog {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 1rem;
  backdrop-filter: blur(4px);
}
.confirm-dialog.active {
  display: flex;
}
.confirm-box {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s ease;
  border: 1px solid var(--border-light);
}
.confirm-box h3 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 0.75rem;
}
.confirm-box p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.detail-badge-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.detail-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.detail-badge.class-badge {
  background: var(--amber-light);
  color: #92400e;
  border-color: var(--amber-soft);
}
.detail-badge.vol-badge {
  background: var(--blue-light);
  color: var(--blue-dark);
  border-color: var(--blue-soft);
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--border-light) 25%,
    var(--border) 50%,
    var(--border-light) 75%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s infinite;
  border-radius: var(--radius-xs);
}
.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
}
.skeleton-title {
  height: 1.25rem;
  width: 60%;
  margin-bottom: 1rem;
}
.skeleton-card {
  height: 120px;
  margin-bottom: 1rem;
}

.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring-circle {
  transition: stroke-dashoffset 0.5s ease;
}

/* ===== ANALYSIS STYLES ===== */
.analysis-bar-chart {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 260px;
  padding: 0 0.5rem;
  gap: 0.5rem;
}
.analysis-bar-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  max-width: 60px;
  gap: 0.25rem;
}
.analysis-bar-stack {
  display: flex;
  flex-direction: column-reverse;
  width: 100%;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  min-height: 4px;
}
.analysis-bar-segment {
  width: 100%;
  transition: height 0.4s ease;
}
.analysis-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}
.analysis-bar-value {
  font-size: 0.6rem;
  color: var(--text-secondary);
  text-align: center;
}
.analysis-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
  justify-content: center;
}
.analysis-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.analysis-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}
.analysis-class-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}
.analysis-class-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border-light);
  border-radius: 4px;
  overflow: hidden;
}
.analysis-class-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}
.analysis-class-count {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--navy);
  min-width: 32px;
  text-align: right;
}
.analysis-class-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 120px;
}
.analysis-table-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 1rem;
  padding: 0.875rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  align-items: center;
}
.analysis-table-row:last-child {
  border-bottom: none;
}
.analysis-table-header {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.analysis-trend-line {
  stroke: var(--navy);
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.analysis-trend-area {
  fill: rgba(10, 37, 64, 0.08);
}
.analysis-trend-dot {
  fill: var(--navy);
  r: 4;
}
.analysis-trend-grid {
  stroke: var(--border-light);
  stroke-width: 1;
}
.analysis-trend-axis {
  stroke: var(--muted);
  stroke-width: 1;
}
.analysis-trend-label {
  font-size: 0.65rem;
  fill: var(--muted);
  font-weight: 600;
}
.analysis-trend-value {
  font-size: 0.7rem;
  fill: var(--navy);
  font-weight: 700;
}
.analysis-y-axis-label {
  font-size: 0.6rem;
  fill: var(--muted);
  font-weight: 600;
}

.disposal-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.875rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.disposal-badge.internal {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1.5px solid var(--green-soft);
}
.disposal-badge.external {
  background: var(--orange-light);
  color: #9a3412;
  border: 1.5px solid var(--orange-soft);
}
.tracker-dot.president {
  background: var(--purple) !important;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.25) !important;
}
.tracker-dot.owner {
  background: linear-gradient(135deg, var(--amber), var(--orange)) !important;
  box-shadow: 0 2px 8px rgba(245, 166, 35, 0.25) !important;
}
.print-area {
  display: none;
}

/* ===== PRINT STYLES ===== */
@media print {
  @page {
    margin: 10mm;
    size: auto;
  }
  body {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    background: #fff;
    margin: 0;
    padding: 0;
  }

  /* Hide all app UI completely so hidden elements don't create blank pages */
  #loginView,
  #appShell,
  .topbar,
  .sidebar,
  .bottom-nav,
  .debug-toggle,
  .debug-panel,
  .modal-overlay,
  .confirm-dialog,
  .loading-overlay,
  .toast,
  .actions-bar,
  .no-print {
    display: none !important;
  }

  /* Show only print area */
  #printArea,
  .print-area {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    left: auto !important;
    top: auto !important;
    visibility: visible !important;
  }

  svg {
    display: block !important;
    visibility: visible !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .print-form {
    border: none;
    padding: 0;
    max-width: 100%;
    margin: 0 auto;
    background: #fff;
    font-family: "Century Gothic", Arial, sans-serif;
    box-sizing: border-box;
    box-shadow: none !important;
  }
  .print-header {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    border-bottom: 1.5px solid #000;
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
  }
  .print-header-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }
  .print-header-center {
    text-align: center !important;
  }
  .print-header-right {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-end !important;
    justify-content: flex-start !important;
    text-align: right !important;
  }
  .print-logo {
    height: 36px;
  }
  .print-title {
    text-align: left !important;
    font-size: 16pt !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
    font-family: "Century Gothic", Arial, sans-serif !important;
  }
  .print-meta {
    text-align: left !important;
    font-size: 9pt !important;
    font-family: "Century Gothic", Arial, sans-serif !important;
    font-weight: 700 !important;
    margin-bottom: 0.4rem !important;
  }
  .print-entry-number {
    font-family: "Century Gothic", Arial, sans-serif !important;
    font-size: 9pt !important;
    font-weight: 700 !important;
    margin-top: 0.25rem !important;
    color: #000 !important;
  }
  .print-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
  }
  .print-field {
    flex: 1;
    border-bottom: 1px solid #333;
    padding-bottom: 0.15rem;
  }
  .print-field label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    display: block;
    margin-bottom: 0.15rem;
  }
  .print-field-value {
    font-size: 0.85rem;
    min-height: 1.1rem;
  }
  .print-checkboxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem;
    margin: 0.4rem 0;
  }
  .print-check-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
  }
  .print-check-box {
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .print-check-box.checked::after {
    content: "✓";
    font-weight: bold;
    font-size: 0.65rem;
  }
  .print-signatures {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.5rem;
    border-top: 1.5px solid #000;
    padding-top: 0.5rem;
  }
  .print-sig-box {
    text-align: center;
  }
  .print-sig-line {
    border-bottom: 1px solid #000;
    height: 56px;
    margin-bottom: 0.3rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }
  .print-sig-line img {
    max-height: 26px;
  }
  .print-sig-label {
    font-size: 0.65rem;
    font-weight: 700;
  }

  /* Analysis print helpers */
  .analysis-bar-chart {
    overflow: hidden;
    max-width: 100%;
  }
  .analysis-bar-group {
    max-width: 45px;
  }
  .print-section {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .print-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
  }
  .print-card {
    padding: 0.5rem;
  }
  .print-card-value {
    font-size: 1.25rem;
  }
  .cards-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 0.5rem !important;
  }
  .status-card {
    padding: 0.75rem !important;
    break-inside: avoid;
  }
  .card-count {
    font-size: 1.5rem !important;
  }
  .entry-item {
    break-inside: avoid;
    padding: 0.5rem !important;
  }
  .detail-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .detail-sidebar {
    display: none !important;
  }
  .detail-main {
    padding: 1rem !important;
  }
  .tracker-step {
    padding-bottom: 0.5rem !important;
  }
  .form-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem !important;
  }
  .checkbox-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .signature-canvas {
    height: 100px !important;
  }
}

/* ===== ANALYSIS PRINT STYLES ===== */
.analysis-print-wrapper {
  background: #fff;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #0f172a;
}
.analysis-print-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-bottom: 1.25rem;
  margin-bottom: 1.5rem;
  border-bottom: 3px solid #0a2540;
}
.analysis-print-brand img {
  height: 48px;
}
.analysis-print-title-block h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0a2540;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}
.analysis-print-meta {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 0 0.125rem;
  font-weight: 500;
}
.analysis-print-date {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0;
  font-weight: 500;
}
.analysis-print-section {
  margin-bottom: 1.5rem;
  page-break-inside: avoid;
  break-inside: avoid;
}
.analysis-print-section h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #0a2540;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #f5a623;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.analysis-print-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.analysis-print-cards-grid.four {
  grid-template-columns: repeat(4, 1fr);
}
.analysis-print-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  background: #fff;
  page-break-inside: avoid;
  break-inside: avoid;
  position: relative;
  overflow: hidden;
}
.analysis-print-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  border-radius: 12px 12px 0 0;
}
.analysis-print-card.navy::before {
  background: #0a2540;
}
.analysis-print-card.purple::before {
  background: #8b5cf6;
}
.analysis-print-card.amber::before {
  background: #f5a623;
}
.analysis-print-card.green::before {
  background: #00c853;
}
.analysis-print-card.blue::before {
  background: #3b82f6;
}
.analysis-print-card.orange::before {
  background: #f97316;
}
.analysis-print-card-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}
.analysis-print-card-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0a2540;
  line-height: 1;
}
.analysis-print-card-footer {
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 500;
}
.analysis-print-card-trend {
  font-size: 0.8rem;
  font-weight: 700;
  color: #00c853;
  margin-top: 0.25rem;
}
.analysis-print-chart-box {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #f8fafc;
  overflow: hidden;
  max-width: 100%;
}
.analysis-print-chart-box svg {
  max-width: 100%;
  height: auto;
}
.analysis-print-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.analysis-print-dual-col {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
}
.analysis-print-class-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.analysis-print-table-box {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  overflow-x: auto;
}
.analysis-print-disposal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.analysis-print-footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 2px solid #e2e8f0;
  font-size: 0.75rem;
  color: #94a3b8;
}
.analysis-print-footer p {
  margin: 0.25rem 0;
}

@media print {
  /* CRITICAL FIX: Don't hide body children that are the print area */
  /* Instead of body > * { display: none }, hide specific app elements */
  #loginView,
  #appShell,
  .topbar,
  .sidebar,
  .bottom-nav,
  .debug-toggle,
  .debug-panel,
  .modal-overlay,
  .confirm-dialog,
  .loading-overlay,
  .toast,
  .actions-bar,
  .no-print {
    display: none !important;
  }

  /* Show the analysis print area */
  #analysisPrintArea {
    display: block !important;
    position: static !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    visibility: visible !important;
  }

  /* CRITICAL FIX: Don't force ALL descendants to display:block */
  /* Only ensure visibility, preserve original display types */
  #analysisPrintArea * {
    visibility: visible !important;
  }

  /* CRITICAL FIX: Preserve flex layouts for charts */
  #analysisPrintArea div[style*="display:flex"],
  #analysisPrintArea div[style*="display: flex"] {
    display: flex !important;
  }

  /* Preserve flex-direction for column-reverse bar stacks */
  #analysisPrintArea div[style*="flex-direction:column-reverse"],
  #analysisPrintArea div[style*="flex-direction: column-reverse"] {
    display: flex !important;
    flex-direction: column-reverse !important;
  }

  #analysisPrintArea div[style*="flex-direction:column"],
  #analysisPrintArea div[style*="flex-direction: column"] {
    display: flex !important;
    flex-direction: column !important;
  }

  /* Preserve inline-block and other display types */
  #analysisPrintArea span,
  #analysisPrintArea img {
    display: inline !important;
    visibility: visible !important;
  }

  #analysisPrintArea svg {
    display: block !important;
    visibility: visible !important;
    max-width: 100% !important;
    height: auto !important;
  }

  .analysis-print-wrapper {
    padding: 1rem !important;
    max-width: 100% !important;
  }

  .analysis-print-section,
  .analysis-print-card {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .analysis-print-chart-box,
  .analysis-print-table-box {
    overflow: hidden !important;
    max-width: 100% !important;
  }

  .btn,
  button,
  .no-print {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .analysis-print-cards-grid,
  .analysis-print-cards-grid.four {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .analysis-print-dual-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 480px) {
  .analysis-print-cards-grid,
  .analysis-print-cards-grid.four {
    grid-template-columns: 1fr !important;
  }
  .analysis-print-wrapper {
    padding: 0.75rem !important;
  }
}

/* ===== MOBILE IMPROVEMENTS ===== */
@media (max-width: 768px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
  .status-card {
    padding: 1rem !important;
  }
  .card-count {
    font-size: 1.75rem !important;
  }
  .section-title {
    font-size: 1.1rem !important;
  }
  .entry-item {
    padding: 0.875rem !important;
  }
  .form-container {
    padding: 1rem !important;
  }
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .checkbox-grid {
    grid-template-columns: 1fr !important;
  }
  .detail-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
  .detail-main {
    padding: 1rem !important;
  }
  .tracker-card {
    padding: 1rem !important;
  }
  .archive-filters {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
  }
  .filter-group {
    min-width: 100% !important;
  }
  .analysis-bar-chart {
    height: 180px !important;
  }
  .analysis-bar-group {
    max-width: 40px;
  }
  .analysis-table-row {
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr !important;
    gap: 0.5rem !important;
    padding: 0.5rem !important;
    font-size: 0.8rem !important;
  }
  .login-card {
    max-width: 100% !important;
    border-radius: var(--radius-sm) !important;
  }
  .login-body {
    padding: 1.25rem !important;
  }
  .login-header {
    padding: 1.5rem !important;
  }
  .btn {
    font-size: 0.875rem !important;
    padding: 0.5rem 0.75rem !important;
  }
  .topbar-brand h1 {
    font-size: 0.9rem !important;
  }
  .badge {
    font-size: 0.65rem !important;
    padding: 0.2rem 0.5rem !important;
  }
  .bottom-item {
    font-size: 0.6rem !important;
  }
  .bottom-icon {
    font-size: 1.2rem !important;
  }
  .main-content {
    padding: 0.75rem !important;
  }
}

@media (max-width: 480px) {
  .cards-grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .card-count {
    font-size: 1.5rem !important;
  }
  .analysis-table-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
  }
  .analysis-table-header {
    display: none !important;
  }
  .analysis-bar-chart {
    height: 150px !important;
  }
  .entry-right {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.25rem !important;
  }
  .entry-status {
    font-size: 0.6rem !important;
    padding: 0.2rem 0.5rem !important;
  }
  .form-title {
    font-size: 1.1rem !important;
  }
  .signature-canvas {
    height: 220px !important;
  }
  .print-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== FOCUS IMPROVEMENTS ===== */
*:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* ===== IMAGE UPLOAD CARDS ===== */
.image-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 0.75rem 0 1.25rem;
}

.image-upload-card {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem 0.75rem;
  text-align: center;
  min-height: 160px;
  background: var(--bg);
  transition: all 0.25s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  overflow: hidden;
}

.image-upload-card:hover {
  border-color: var(--navy);
  background: var(--surface);
}

.image-upload-card.dragover {
  border-color: var(--blue);
  background: var(--blue-light);
  transform: scale(1.01);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.image-upload-card.has-image {
  border-style: solid;
  border-color: var(--green-soft);
  background: var(--green-light);
  padding: 0.5rem;
  min-height: 140px;
}

.image-upload-card.has-pending {
  border-style: solid;
  border-color: var(--amber-soft);
  background: var(--amber-light);
}

.image-upload-card .upload-icon {
  font-size: 2rem;
  opacity: 0.6;
  transition: var(--transition);
}

.image-upload-card:hover .upload-icon {
  opacity: 0.9;
  transform: scale(1.05);
}

.image-upload-card .upload-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
}

.image-upload-card .upload-hint {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

.image-upload-card .preview-img {
  max-width: 100%;
  max-height: 110px;
  border-radius: var(--radius-xs);
  object-fit: contain;
  background: #fff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: var(--transition);
}

.image-upload-card .preview-img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md);
}

.image-upload-card .card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.image-upload-card .card-actions .btn {
  font-size: 0.65rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-weight: 700;
}

.image-upload-card .upload-progress {
  width: 100%;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.25rem;
}

.image-upload-card .upload-progress .progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue), var(--navy));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.image-upload-card .remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  opacity: 0.8;
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

.image-upload-card .remove-btn:hover {
  opacity: 1;
  transform: scale(1.1);
}

.image-upload-card .card-index-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--navy);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  opacity: 0.7;
  z-index: 2;
}

.image-upload-card .card-index-badge.pending {
  background: var(--amber);
  opacity: 1;
}

.image-upload-card .card-index-badge.uploaded {
  background: var(--green);
  opacity: 1;
}

.image-upload-card .file-input-hidden {
  display: none;
}

.image-upload-card .pending-badge {
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--amber);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  display: inline-block;
  margin-top: 0.1rem;
}

/* ===== DETAIL VIEW IMAGES ===== */
.detail-images-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.detail-images-grid .detail-img-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: #fff;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.detail-images-grid .detail-img-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
}

.detail-images-grid .detail-img-card img:hover {
  transform: scale(1.03);
}

.detail-images-grid .detail-img-card .no-img-placeholder {
  font-size: 0.7rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  padding: 0.5rem;
}

/* ===== IMAGE VIEW MODAL ===== */
.image-view-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  backdrop-filter: blur(4px);
}

.image-view-modal.active {
  display: flex;
}

.image-view-modal .view-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}

.image-view-modal .view-content img {
  max-width: 100%;
  max-height: 80vh;
  display: block;
  border-radius: var(--radius-xs);
}

.image-view-modal .view-close {
  position: absolute;
  top: -12px;
  right: -12px;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-view-modal .view-close:hover {
  transform: scale(1.1);
}

.image-view-modal .view-label {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-xs);
}

@media (max-width: 640px) {
  .image-upload-grid {
    grid-template-columns: 1fr 1fr;
  }
  .image-upload-grid .image-upload-card:last-child {
    grid-column: 1 / -1;
  }
  .detail-images-grid {
    grid-template-columns: 1fr 1fr;
  }
  .detail-images-grid .detail-img-card:last-child {
    grid-column: 1 / -1;
  }
  .image-view-modal .view-content {
    padding: 0.75rem;
  }
  .image-view-modal .view-close {
    top: -10px;
    right: -10px;
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }
}

@media (max-width: 420px) {
  .image-upload-grid {
    grid-template-columns: 1fr;
  }
  .image-upload-grid .image-upload-card:last-child {
    grid-column: 1;
  }
  .detail-images-grid {
    grid-template-columns: 1fr;
  }
  .detail-images-grid .detail-img-card:last-child {
    grid-column: 1;
  }
}

/* ===== FORM SUBMITTING STATE ===== */
.btn-loading {
  position: relative;
  color: transparent !important;
}
.btn-loading::after {
  content: "";
  position: absolute;
  width: 1.2rem;
  height: 1.2rem;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
