@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Source+Sans+3:wght@400;500;600;700&display=swap");

:root {
  --font-display: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: "Source Sans 3", -apple-system, BlinkMacSystemFont, sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

  --color-primary: #6366f1;
  --color-primary-hover: #4f46e5;
  --color-primary-light: #818cf8;
  --color-primary-subtle: #eef2ff;

  --color-success: #10b981;
  --color-success-light: #d1fae5;
  --color-warning: #f59e0b;
  --color-warning-light: #fef3c7;
  --color-error: #ef4444;
  --color-error-light: #fee2e2;
  --color-info: #3b82f6;
  --color-info-light: #dbeafe;

  --color-surface: #ffffff;
  --color-surface-elevated: #ffffff;
  --color-surface-hover: #f8fafc;
  --color-surface-muted: #f1f5f9;

  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;

  --color-text: #1e293b;
  --color-text-secondary: #64748b;
  --color-text-muted: #94a3b8;
  --color-text-inverse: #ffffff;

  --color-backdrop: rgba(15, 23, 42, 0.6);

  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);

  --pass-a: #10b981;
  --pass-b: #3b82f6;
  --pass-c: #8b5cf6;
  --pass-d: #f59e0b;
  --pass-e: #ec4899;
  --pass-default: #64748b;

  --status-pending: #f59e0b;
  --status-approved: #10b981;
  --status-printed: #3b82f6;
  --status-collected: #8b5cf6;
  --status-cancelled: #ef4444;
  --status-default: #64748b;

}

.dark-theme {
  --color-primary: #818cf8;
  --color-primary-hover: #a5b4fc;
  --color-primary-light: #6366f1;
  --color-primary-subtle: rgba(99, 102, 241, 0.15);

  --color-success-light: rgba(16, 185, 129, 0.2);
  --color-warning-light: rgba(245, 158, 11, 0.2);
  --color-error-light: rgba(239, 68, 68, 0.2);
  --color-info-light: rgba(59, 130, 246, 0.2);

  --color-surface: #0f172a;
  --color-surface-elevated: #1e293b;
  --color-surface-hover: #334155;
  --color-surface-muted: #1e293b;

  --color-border: #334155;
  --color-border-light: #1e293b;

  --color-text: #f1f5f9;
  --color-text-secondary: #94a3b8;
  --color-text-muted: #64748b;

  --color-backdrop: rgba(0, 0, 0, 0.75);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.3);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.4), 0 4px 6px -4px rgb(0 0 0 / 0.3);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.5), 0 8px 10px -6px rgb(0 0 0 / 0.4);
}

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

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
}

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

.page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: var(--space-8);
  gap: var(--space-6);
  animation: fadeIn var(--transition-slow);
}

.page-shell-auth {
  justify-content: center;
  max-width: 720px;
}

.auth-card {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
  display: grid;
  gap: var(--space-6);
}

.auth-form {
  display: grid;
  gap: var(--space-4);
}

.auth-field {
  display: grid;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.hero-card,
.table-card,
.admin-card {
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}

.hero-card,
.admin-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-6);
  padding: var(--space-8);
}

.table-card {
  padding: var(--space-6);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

.hero-copy,
.table-header p,
.admin-card p {
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
}

.gate-actions {
  justify-content: center;
}

.primary-button,
.secondary-button,
.file-input span,
.remove-button {
  border-radius: var(--radius-md);
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: all var(--transition-base);
  min-height: 44px;
  padding: 0 var(--space-4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
}

.primary-button:hover,
.secondary-button:hover,
.file-input span:hover,
.remove-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.file-input span:active,
.remove-button:active {
  transform: translateY(0);
}

.primary-button {
  background: var(--gradient-primary);
  border: none;
  color: var(--color-text-inverse);
}

.primary-button:hover {
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.secondary-button,
.file-input span,
.remove-button {
  background-color: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.secondary-button:hover,
.file-input span:hover,
.remove-button:hover {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary-light);
}

.remove-button {
  min-height: 36px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background-color: transparent;
  color: var(--color-primary);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition-base);
}

.icon-button:hover {
  transform: translateY(-1px);
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary-light);
}

.file-input {
  position: relative;
  overflow: hidden;
}

.file-input input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.table-header {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  align-items: flex-start;
  margin-bottom: var(--space-4);
}

.status-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.badge-muted {
  background-color: var(--color-surface-muted);
  color: var(--color-text-secondary);
}

.badge-danger {
  background-color: var(--color-error-light);
  color: var(--status-cancelled);
}

.message-bar {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.message-bar.success {
  background-color: var(--color-success-light);
  color: var(--color-success);
}

.message-bar.error {
  background-color: var(--color-error-light);
  color: var(--color-error);
}

.message-bar.info {
  background-color: var(--color-info-light);
  color: var(--color-info);
}

.table-scroll {
  overflow: auto;
}

.admin-filter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.admin-filter {
  display: grid;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 600;
}

.admin-download-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.grid-context-bar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 280px));
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.sheet-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background-color: transparent;
}

.sheet-table thead tr {
  background-color: var(--color-surface-muted);
}

.sheet-table th {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
  position: sticky;
  top: 0;
  background-color: var(--color-surface-muted);
  z-index: 1;
  text-align: left;
}

.sheet-table td,
.sheet-table th {
  padding: var(--space-3);
  border-right: 1px solid var(--color-border-light);
}

.sheet-table td {
  border-bottom: 1px solid var(--color-border-light);
}

.sheet-table td:last-child,
.sheet-table th:last-child {
  border-right: 0;
}

.sheet-table th:nth-child(1),
.sheet-table td:nth-child(1) {
  width: 100px;
}

.sheet-table th:nth-child(2),
.sheet-table td:nth-child(2) {
  width: 220px;
}

.sheet-table th:nth-child(3),
.sheet-table td:nth-child(3) {
  width: 160px;
}

.sheet-table th:nth-child(4),
.sheet-table td:nth-child(4) {
  width: 160px;
}

.sheet-table th:nth-child(5),
.sheet-table td:nth-child(5) {
  width: 120px;
}

.sheet-table th:nth-child(6),
.sheet-table td:nth-child(6) {
  width: 130px;
}

.sheet-table th:nth-child(7),
.sheet-table td:nth-child(7) {
  width: 200px;
}

.sheet-table th:nth-child(8),
.sheet-table td:nth-child(8) {
  width: 96px;
}

.sheet-table tbody tr {
  transition: all var(--transition-fast);
}

.sheet-table tbody tr:hover {
  background-color: var(--color-surface-hover);
}

.sheet-input,
.sheet-select,
.sheet-textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-text);
  padding: 0.75rem 0.875rem;
  font-family: var(--font-body);
  transition: all var(--transition-base);
}

.sheet-input::placeholder,
.sheet-textarea::placeholder {
  color: var(--color-text-muted);
}

.sheet-input:focus,
.sheet-select:focus,
.sheet-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.sheet-textarea {
  min-height: 84px;
  resize: vertical;
}

.checkbox-group {
  display: grid;
  gap: var(--space-2);
}

.checkbox-option {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.checkbox-option input {
  accent-color: var(--color-primary);
}

.cell-error .sheet-input,
.cell-error .sheet-select,
.cell-error .sheet-textarea,
.cell-error .checkbox-group {
  border-color: var(--color-error);
}

.field-error {
  margin-top: var(--space-2);
  color: var(--color-error);
  font-size: var(--text-xs);
  font-weight: 600;
}

.char-counter {
  display: block;
  margin-top: var(--space-2);
  text-align: right;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
}

.admin-groups {
  display: grid;
  gap: var(--space-6);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #1d4ed8;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.top-nav-inner {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: var(--space-3) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.top-nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  display: grid;
  gap: 2px;
}

.top-nav-brand #adminTopBarGreeting {
  line-height: 1.1;
  font-size: var(--text-sm);
  font-weight: 600;
}

.user-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: #1d4ed8;
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.user-topbar-inner {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: var(--space-3) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.user-topbar-text {
  display: grid;
  gap: 2px;
}

.user-topbar-greeting {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  line-height: 1.1;
}

.user-topbar-role {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-xs);
  opacity: 0.9;
  line-height: 1.1;
}

.user-topbar-logout {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.user-topbar-logout:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.top-nav-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.top-nav-tab {
  border: 1px solid rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.top-nav-tab:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.top-nav-tab--active {
  background-color: #ffffff;
  color: #1d4ed8;
  border-color: #ffffff;
}

.top-nav-actions {
  display: flex;
  align-items: center;
}

.top-nav-signout {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-radius: var(--radius-full);
  padding: var(--space-2) var(--space-4);
  font-family: var(--font-display);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-base);
}

.top-nav-signout:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.admin-section-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.admin-pill--active {
  background-color: var(--color-surface-hover);
  border-color: var(--color-primary-light);
}

.submission-card {
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.submission-summary {
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  cursor: pointer;
}

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

.submission-summary p {
  margin: var(--space-1) 0 0;
  color: var(--color-text-secondary);
}

.submission-summary-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
}

.submission-body {
  display: grid;
  gap: var(--space-4);
  padding: 0 var(--space-5) var(--space-5);
}

.group-block {
  display: grid;
  gap: var(--space-4);
}

.group-header,
.nizamat-header,
.request-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-3);
}

.group-header {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
}

.nizamat-block {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-5);
  background-color: var(--color-surface-hover);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
}

.request-list {
  display: grid;
  gap: var(--space-3);
}

.request-card {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-4);
  background-color: var(--color-surface-elevated);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}

.request-card-top h3 {
  font-size: var(--text-lg);
}

.request-card-top p {
  margin-top: var(--space-1);
  color: var(--color-text-secondary);
}

.request-meta {
  display: grid;
  gap: var(--space-2);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
}

.request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

a[aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.55;
}

.empty-state {
  padding: var(--space-8);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background-color: var(--color-surface-hover);
}

.empty-state p {
  margin-top: var(--space-2);
  color: var(--color-text-secondary);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.status-badge--pending {
  background-color: var(--color-warning-light);
  color: var(--status-pending);
}

.status-badge--approved {
  background-color: var(--color-success-light);
  color: var(--status-approved);
}

.status-badge--printed,
.status-badge--reprinted {
  background-color: var(--color-info-light);
  color: var(--status-printed);
}

.status-badge--collected,
.status-badge--recollected,
.status-badge--posted,
.status-badge--reposted {
  background-color: rgba(139, 92, 246, 0.15);
  color: var(--status-collected);
}

.status-badge--cancelled {
  background-color: var(--color-error-light);
  color: var(--status-cancelled);
}

.pass-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 var(--space-2);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-display);
  color: white;
}

.pass-badge--a {
  background-color: var(--pass-a);
}

.pass-badge--b {
  background-color: var(--pass-b);
}

.pass-badge--c {
  background-color: var(--pass-c);
}

.pass-badge--d {
  background-color: var(--pass-d);
}

.pass-badge--e {
  background-color: var(--pass-e);
}

.pass-badge--default {
  background-color: var(--pass-default);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(10px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.6;
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .no-print {
    display: none !important;
  }
}

@media (max-width: 960px) {
  .page-shell {
    padding: var(--space-4);
  }

  .hero-card,
  .admin-card,
  .table-header {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-filter-grid {
    grid-template-columns: 1fr;
  }

  .grid-context-bar {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .page-shell {
    padding: var(--space-3);
  }

  .hero-card,
  .table-card,
  .admin-card {
    padding: var(--space-4);
  }

  .hero-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .file-input,
  .file-input span {
    width: 100%;
  }
}
