/* ============================================================
   SACKS SOFTWARE LABS — ADMIN PANEL
   Matches the front-end website design system exactly.
   Source of truth: /css/style.css
   ============================================================ */

/* ---------- DESIGN TOKENS (copied from style.css) ---------- */
:root {
  --brand-blue:       #00A9E0;
  --brand-blue-light: #33BFEA;
  --brand-blue-dark:  #0087B3;
  --brand-green:      #93D900;
  --brand-green-light:#A8E333;
  --brand-green-dark: #76AD00;
  --brand-teal:       #0d9488;
  --brand-teal-dark:  #115e59;

  --gray-50:  #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1E293B;
  --gray-900: #0F172A;
  --gray-950: #020617;

  --color-text:          var(--gray-900);
  --color-text-secondary:var(--gray-600);
  --color-text-muted:    var(--gray-400);
  --color-bg:            #FFFFFF;
  --color-bg-alt:        var(--gray-50);
  --color-bg-elevated:   #FFFFFF;
  --color-border:        var(--gray-200);
  --color-border-hover:  var(--gray-300);
  --color-accent:        var(--brand-blue);
  --color-accent-hover:  var(--brand-blue-dark);
  --color-success:       var(--brand-green);
  --color-danger:        #EF4444;
  --color-danger-bg:     #FEF2F2;

  --glass-bg:     rgba(255, 255, 255, 0.85);
  --glass-border: rgba(255, 255, 255, 0.3);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);

  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md:        0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg:        0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl:        0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-2xl:       0 25px 50px -12px rgba(0, 0, 0, 0.15);
  --shadow-glow-blue: 0 0 20px rgba(0, 169, 224, 0.15);
  --shadow-glow-green:0 0 20px rgba(147, 217, 0, 0.15);

  --radius-sm:   6px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-2xl:  24px;
  --radius-full: 9999px;

  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast:   150ms;
  --duration-base:   250ms;
  --duration-slow:   400ms;

  --header-height:  72px;
  --container-max:  1200px;
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img, video, svg { display: block; max-width: 100%; height: auto; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ---------- BASE ---------- */
body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  /* Subtle background orbs matching the front-end */
  background-image:
    radial-gradient(ellipse 600px 500px at 80% -10%, rgba(0, 169, 224, 0.06) 0%, transparent 70%),
    radial-gradient(ellipse 500px 400px at -10% 90%, rgba(147, 217, 0, 0.05) 0%, transparent 70%);
  background-attachment: fixed;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

a { color: var(--color-accent); text-decoration: none; transition: color var(--duration-fast); }
a:hover { color: var(--color-accent-hover); }
ul, ol { list-style: none; }

/* ---------- ADMIN HEADER — mirrors .site-header ---------- */
.admin-header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--glass-shadow);
  transition: all var(--duration-base) var(--ease-out);
}

.admin-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-height);
  padding: 0 var(--space, 1.5rem);
  gap: 1.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

/* Logo in header */
.admin-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow:
    0 0 20px rgba(0, 169, 224, 0.2),
    0 0 40px rgba(147, 217, 0, 0.1),
    var(--shadow-md);
  transition: box-shadow var(--duration-base);
}

.admin-logo:hover {
  box-shadow:
    0 0 30px rgba(0, 169, 224, 0.3),
    0 0 60px rgba(147, 217, 0, 0.15),
    var(--shadow-lg);
}

.admin-logo img,
.admin-logo video {
  height: 44px;
  width: auto;
  display: block;
}

.admin-header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-page-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  background: rgba(0, 169, 224, 0.08);
  border: 1px solid rgba(0, 169, 224, 0.15);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.admin-user-greeting {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ---------- LAYOUT ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
  gap: 1rem;
}

.page-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 0.25rem;
}

/* Gradient underline accent — matches .section-title::after */
.page-title-accent {
  display: block;
  width: 40px;
  height: 3px;
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-green));
  border-radius: var(--radius-full);
  margin-top: 0.5rem;
}

/* ---------- BUTTONS (matches style.css .btn exactly) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--duration-base) var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

/* Primary — same as site .btn-primary */
.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-blue-dark));
  color: #fff;
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-md), var(--shadow-glow-blue);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand-blue-light), var(--brand-blue));
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); }

/* Secondary — same as site .btn-secondary */
.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--color-bg-alt);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}
.btn-ghost:hover {
  color: var(--color-text);
  background: var(--color-bg-alt);
}

/* Danger */
.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
  box-shadow: var(--shadow-sm);
}
.btn-danger:hover {
  background: #DC2626;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  color: #fff;
}

/* Sizes */
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.75rem; }
.btn-lg { padding: 1rem 2rem; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: var(--shadow-sm) !important;
}

/* ---------- CARDS (matches style.css .card exactly) ---------- */
.card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card:hover {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  transform: translateY(-2px);
}

.card-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.card-header h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

.card-content {
  padding: 1.75rem;
}

/* ---------- STAT CARDS ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}

/* Brand gradient left accent */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--brand-blue), var(--brand-green));
  border-radius: var(--radius-xl) 0 0 var(--radius-xl);
}

.stat-card:hover {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  transform: translateY(-2px);
}

.stat-card h3 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
}

.stat-card .value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

/* ---------- QUICK ACTIONS ---------- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.action-card {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 1.75rem 1.5rem;
  text-align: center;
  transition: all var(--duration-base) var(--ease-out);
  cursor: pointer;
}

.action-card:hover {
  border-color: var(--brand-blue);
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  transform: translateY(-2px);
}

.action-card a {
  text-decoration: none;
  color: inherit;
  display: block;
}

.action-card .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(0, 169, 224, 0.1), rgba(147, 217, 0, 0.1));
  font-size: 1.25rem;
  margin: 0 auto 1rem;
}

.action-card h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}

.action-card p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.375rem;
  letter-spacing: -0.01em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--color-text);
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
  appearance: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="datetime-local"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 169, 224, 0.12);
}

textarea { resize: vertical; min-height: 100px; line-height: 1.6; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.help-text {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* ---------- ALERTS / FLASH ---------- */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-lg);
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
}

.alert-success {
  background: rgba(147, 217, 0, 0.08);
  color: #3a6b00;
  border: 1px solid rgba(147, 217, 0, 0.3);
}

.alert-error {
  background: var(--color-danger-bg);
  color: #991B1B;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

/* ---------- BADGES ---------- */
.badge, .status-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-success, .status-active {
  background: rgba(147, 217, 0, 0.12);
  color: #3a6b00;
  border: 1px solid rgba(147, 217, 0, 0.25);
}

.badge-error, .status-inactive {
  background: rgba(239, 68, 68, 0.08);
  color: #991B1B;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-blue {
  background: rgba(0, 169, 224, 0.1);
  color: var(--brand-blue-dark);
  border: 1px solid rgba(0, 169, 224, 0.2);
}

/* ---------- TABLES ---------- */
.table-wrapper { overflow-x: auto; border-radius: 0 0 var(--radius-xl) var(--radius-xl); }

table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }

table thead th {
  text-align: left;
  padding: 0.75rem 1.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: var(--gray-50);
  border-bottom: 1px solid var(--color-border);
  font-family: var(--font-mono);
}

table tbody td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--color-text);
  vertical-align: middle;
}

table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover td { background: var(--gray-50); }

/* ---------- FILE LIST ---------- */
.file-list { list-style: none; }

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.125rem 1.75rem;
  border-bottom: 1px solid var(--gray-100);
  transition: background var(--duration-fast);
}

.file-item:last-child { border-bottom: none; }
.file-item:hover { background: var(--gray-50); }

.file-info { display: flex; align-items: center; gap: 1rem; flex: 1; min-width: 0; }
.file-icon { font-size: 1.75rem; flex-shrink: 0; }
.file-details { min-width: 0; }
.file-details h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.15rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-details p {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.1rem;
}
.project-info {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brand-blue);
}
.file-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.375rem;
  flex-shrink: 0;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
}

/* ---------- SEARCH / FILTERS ---------- */
.search-box {
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--gray-100);
}

.search-input {
  width: 100%;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  transition: border-color var(--duration-fast), box-shadow var(--duration-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px rgba(0, 169, 224, 0.12);
}

.filters { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.filter-select {
  padding: 0.4rem 0.875rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.filter-select:focus { outline: none; border-color: var(--brand-blue); }
.filter-select:hover { border-color: var(--brand-blue); color: var(--brand-blue); }

/* ---------- ACTIVITY / LISTS ---------- */
.activity-list, .project-list { list-style: none; }

.activity-item, .project-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--gray-100);
}

.activity-item:last-child, .project-item:last-child { border-bottom: none; }

.activity-action { font-size: 0.875rem; font-weight: 500; color: var(--color-text); }
.activity-time { font-size: 0.75rem; color: var(--color-text-muted); font-family: var(--font-mono); }

.project-info-block h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.2rem;
}
.project-info-block p { font-size: 0.8125rem; color: var(--color-text-secondary); }

.project-meta { text-align: right; font-size: 0.8125rem; color: var(--color-text-secondary); }

/* ---------- INFO GRID (project detail) ---------- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.info-item { display: flex; flex-direction: column; gap: 0.25rem; }

.info-label {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.info-value { font-size: 0.9375rem; color: var(--color-text); font-weight: 500; }

/* ---------- QR / UPLOAD URL ---------- */
.upload-url {
  background: var(--gray-50);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  word-break: break-all;
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
}

.qr-section { text-align: center; }
.qr-code {
  max-width: 160px;
  border-radius: var(--radius-lg);
  margin: 1rem auto;
  display: block;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

/* ---------- PROJECT DETAILS LAYOUT ---------- */
.project-details {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

/* ---------- CONTENT GRID ---------- */
.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--color-text-secondary);
}

.empty-state .icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, rgba(0, 169, 224, 0.08), rgba(147, 217, 0, 0.08));
  font-size: 2rem;
  margin: 0 auto 1.25rem;
}

.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 0.5rem;
}

.empty-state p { font-size: 0.9375rem; }

/* ---------- MODAL ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.show { display: flex; }

.modal-content {
  background: var(--color-bg);
  border-radius: var(--radius-2xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-2xl);
  padding: 2rem;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-content h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 1.5rem;
  letter-spacing: -0.02em;
}

/* ---------- LOGIN PAGE ---------- */
.login-bg {
  min-height: 100vh;
  background: var(--color-bg);
  background-image:
    radial-gradient(ellipse 700px 600px at 70% -5%, rgba(0, 169, 224, 0.12) 0%, transparent 65%),
    radial-gradient(ellipse 600px 500px at -10% 100%, rgba(147, 217, 0, 0.08) 0%, transparent 65%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl), var(--shadow-glow-blue);
  padding: 2.5rem;
  width: 100%;
  max-width: 440px;
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo img {
  max-width: 220px;
  height: auto;
  border-radius: var(--radius-lg);
  margin: 0 auto 1rem;
  box-shadow:
    0 0 20px rgba(0, 169, 224, 0.2),
    0 0 40px rgba(147, 217, 0, 0.1),
    var(--shadow-md);
}

.login-logo h2 {
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  letter-spacing: -0.01em;
}

.login-footer {
  text-align: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

/* ---------- SETUP PAGE ---------- */
.setup-bg {
  min-height: 100vh;
  background: var(--color-bg);
  background-image:
    radial-gradient(ellipse 700px 600px at 70% -5%, rgba(0, 169, 224, 0.12) 0%, transparent 65%),
    radial-gradient(ellipse 600px 500px at -10% 100%, rgba(147, 217, 0, 0.08) 0%, transparent 65%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}

.setup-card {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 640px;
  margin: 2rem 0;
}

/* ---------- UPLOAD PAGE (client-facing) ---------- */
.upload-bg {
  min-height: 100vh;
  background: var(--color-bg);
  background-image:
    radial-gradient(ellipse 700px 600px at 80% -5%, rgba(0, 169, 224, 0.1) 0%, transparent 65%),
    radial-gradient(ellipse 600px 500px at -10% 95%, rgba(147, 217, 0, 0.07) 0%, transparent 65%);
  padding: 2rem 1rem;
}

.upload-page-card {
  max-width: 840px;
  margin: 0 auto;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  overflow: hidden;
}

.upload-page-header {
  padding: 2rem 2rem 1.75rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.upload-page-header img {
  height: 40px;
  width: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 0 15px rgba(0, 169, 224, 0.15), var(--shadow-sm);
}

.upload-page-header-text h1 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.upload-page-header-text p {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
}

.upload-content { padding: 2rem; }

.file-drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  text-align: center;
  cursor: pointer;
  background: var(--color-bg-alt);
  transition: all var(--duration-base) var(--ease-out);
}

.file-drop-zone:hover, .file-drop-zone.dragover {
  border-color: var(--brand-blue);
  background: rgba(0, 169, 224, 0.04);
  box-shadow: 0 0 0 4px rgba(0, 169, 224, 0.08);
}

.file-drop-zone.dragover { transform: scale(1.01); }

.upload-icon { font-size: 2.5rem; margin-bottom: 0.75rem; color: var(--brand-blue); }
.upload-text { font-size: 1rem; font-weight: 600; color: var(--color-text); margin-bottom: 0.375rem; }
.upload-hint { font-size: 0.875rem; color: var(--color-text-muted); }

.upload-restrictions {
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-top: 1rem;
}

.upload-restrictions h4 {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #92400E;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
}

.upload-restrictions ul {
  font-size: 0.875rem;
  color: #78350F;
  margin-left: 1.25rem;
  line-height: 1.7;
}

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--gray-200);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin: 1rem 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-blue), var(--brand-green));
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.3s;
}

.existing-files { margin-top: 2rem; }

.existing-files h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}

.existing-file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--color-border);
}

.existing-file-item:last-child { border-bottom: none; }

.selected-files { margin-top: 1rem; }

.remove-file {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all var(--duration-fast);
}

/* ---------- CHECKBOX ---------- */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--color-text);
  cursor: pointer;
}

input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--brand-blue);
  cursor: pointer;
}

/* ---------- DARK MODE ---------- */
[data-theme="dark"] {
  --color-text:          var(--gray-100);
  --color-text-secondary:var(--gray-400);
  --color-text-muted:    var(--gray-500);
  --color-bg:            var(--gray-950);
  --color-bg-alt:        var(--gray-900);
  --color-bg-elevated:   var(--gray-800);
  --color-border:        var(--gray-700);
  --color-border-hover:  var(--gray-600);
  --color-danger-bg:     rgba(239, 68, 68, 0.12);
  --glass-bg:            rgba(15, 23, 42, 0.85);
  --glass-border:        rgba(51, 65, 85, 0.5);
  --glass-shadow:        0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-sm:           0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:           0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg:           0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-xl:           0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --shadow-2xl:          0 25px 50px -12px rgba(0, 0, 0, 0.6);
  --shadow-glow-blue:    0 0 30px rgba(0, 169, 224, 0.2);
  --shadow-glow-green:   0 0 30px rgba(147, 217, 0, 0.2);
}

/* Dark: body background orbs */
[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 600px 500px at 80% -10%, rgba(0, 169, 224, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 500px 400px at -10% 90%, rgba(147, 217, 0, 0.07) 0%, transparent 70%);
}

/* Dark: background pages */
[data-theme="dark"] .login-bg,
[data-theme="dark"] .setup-bg,
[data-theme="dark"] .upload-bg {
  background-image:
    radial-gradient(ellipse 700px 600px at 70% -5%, rgba(0, 169, 224, 0.1) 0%, transparent 65%),
    radial-gradient(ellipse 600px 500px at -10% 100%, rgba(147, 217, 0, 0.07) 0%, transparent 65%);
}

/* Dark: inputs */
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--gray-900);
  color: var(--color-text);
}

/* Dark: search input */
[data-theme="dark"] .search-input {
  background: var(--gray-900);
  color: var(--color-text);
}

/* Dark: filter select */
[data-theme="dark"] .filter-select {
  background: var(--gray-900);
  color: var(--color-text-secondary);
}

/* Dark: table head */
[data-theme="dark"] table thead th {
  background: var(--gray-900);
}

/* Dark: table row hover */
[data-theme="dark"] table tbody tr:hover td {
  background: var(--gray-900);
}

/* Dark: upload URL block */
[data-theme="dark"] .upload-url {
  background: var(--gray-900);
}

/* Dark: btn-secondary */
[data-theme="dark"] .btn-secondary {
  background: var(--gray-800);
  color: var(--color-text);
  border-color: var(--color-border);
}
[data-theme="dark"] .btn-secondary:hover {
  background: var(--gray-700);
}

/* Dark: alert success */
[data-theme="dark"] .alert-success {
  background: rgba(147, 217, 0, 0.1);
  color: #a8e333;
  border-color: rgba(147, 217, 0, 0.25);
}

/* Dark: alert error */
[data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Dark: badge success */
[data-theme="dark"] .badge-success,
[data-theme="dark"] .status-active {
  background: rgba(147, 217, 0, 0.15);
  color: #a8e333;
}

/* Dark: badge error */
[data-theme="dark"] .badge-error,
[data-theme="dark"] .status-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* ---------- THEME TOGGLE BUTTON ---------- */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-text-secondary);
  transition: all var(--duration-fast);
  flex-shrink: 0;
  cursor: pointer;
}

.theme-toggle:hover {
  border-color: var(--brand-blue);
  color: var(--brand-blue);
  background: var(--color-bg-alt);
}

.theme-toggle svg {
  width: 17px;
  height: 17px;
}

/* Show moon in light, sun in dark */
.theme-toggle .icon-moon,
[data-theme="dark"] .theme-toggle .icon-sun {
  display: none;
}

[data-theme="dark"] .theme-toggle .icon-moon {
  display: block;
}

/* ---------- TICKET FILTER TABS ---------- */
.ticket-filter-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.ticket-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-full);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all var(--duration-fast);
}

.ticket-tab:hover {
  background: var(--color-bg-alt);
  color: var(--color-text);
  border-color: var(--color-border);
}

.ticket-tab.active {
  background: var(--color-bg-elevated);
  color: var(--brand-blue);
  border-color: rgba(0, 169, 224, 0.3);
  box-shadow: var(--shadow-sm);
}

.ticket-tab-count {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  padding: 0.1rem 0.45rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  min-width: 1.4rem;
  text-align: center;
}

.ticket-tab.active .ticket-tab-count {
  background: rgba(0, 169, 224, 0.1);
  border-color: rgba(0, 169, 224, 0.2);
  color: var(--brand-blue);
}

/* ---------- TICKET TABLE CELLS ---------- */
.ticket-id-cell {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.ticket-subject-link {
  font-weight: 600;
  color: var(--color-text);
  text-decoration: none;
  transition: color var(--duration-fast);
}

.ticket-subject-link:hover { color: var(--brand-blue); }

.ticket-project-cell {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.ticket-project-cell strong { font-size: 0.875rem; color: var(--color-text); }
.ticket-project-cell span   { font-size: 0.8125rem; color: var(--color-text-secondary); }

.ticket-reply-count {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  text-align: center;
  color: var(--color-text-secondary);
}

.ticket-date-cell {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  white-space: nowrap;
}

/* ---------- TICKET STATUS / PRIORITY BADGES ---------- */
.status-open        { background:rgba(0,169,224,0.1);     color:var(--brand-blue-dark);  border:1px solid rgba(0,169,224,0.25); }
.status-in-progress { background:rgba(251,191,36,0.1);    color:#92400E;                 border:1px solid rgba(251,191,36,0.3); }
.status-closed      { background:rgba(147,217,0,0.1);     color:#3a6b00;                 border:1px solid rgba(147,217,0,0.25); }
.badge-urgent       { background:rgba(239,68,68,0.1);     color:#991B1B;                 border:1px solid rgba(239,68,68,0.25); }
.badge-high         { background:rgba(249,115,22,0.1);    color:#7C2D12;                 border:1px solid rgba(249,115,22,0.25); }
.badge-muted        { background:var(--color-bg-alt);     color:var(--color-text-muted); border:1px solid var(--color-border); }

[data-theme="dark"] .status-in-progress { color:#FDE68A; }
[data-theme="dark"] .badge-high         { color:#FED7AA; }
[data-theme="dark"] .status-closed      { color:#a8e333; }

/* ---------- TICKET DETAIL LAYOUT ---------- */
.ticket-detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.5rem;
  align-items: flex-start;
}

.ticket-thread-col { min-width: 0; }
.ticket-sidebar-col { display: flex; flex-direction: column; gap: 1.25rem; }

/* ---------- TICKET THREAD ---------- */
.ticket-thread {
  padding: 1.25rem 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 120px;
}

.reply-bubble {
  max-width: 80%;
  padding: 0.875rem 1.125rem;
  border-radius: var(--radius-xl);
  position: relative;
}

.reply-client {
  align-self: flex-start;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: var(--radius-sm);
}

.reply-admin {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(0,169,224,0.08), rgba(0,135,179,0.06));
  border: 1px solid rgba(0,169,224,0.2);
  border-bottom-right-radius: var(--radius-sm);
}

.reply-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.reply-author {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--brand-blue);
  font-family: var(--font-mono);
}

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

.reply-time {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
}

.reply-body {
  font-size: 0.9375rem;
  color: var(--color-text);
  line-height: 1.65;
}

/* ---------- REPLY FORM ---------- */
.reply-form textarea {
  min-height: 120px;
}

/* ---------- BACK LINK ---------- */
.back-link {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  text-decoration: none;
  margin-bottom: 0.5rem;
  transition: color var(--duration-fast);
}

.back-link:hover { color: var(--brand-blue); }

/* ---------- CLIENT SUPPORT PORTAL TICKET LIST ---------- */
.support-ticket-list { list-style: none; }

.support-ticket-item { border-bottom: 1px solid var(--color-border); }
.support-ticket-item:last-child { border-bottom: none; }

.support-ticket-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  text-decoration: none;
  gap: 1rem;
  transition: background var(--duration-fast);
}

.support-ticket-link:hover .support-ticket-subject { color: var(--brand-blue); }

.support-ticket-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.support-ticket-subject {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-text);
  transition: color var(--duration-fast);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-ticket-meta {
  font-size: 0.8125rem;
  color: var(--color-text-secondary);
  font-family: var(--font-mono);
}

/* ---------- RESPONSIVE: TICKET DETAIL ---------- */
@media (max-width: 900px) {
  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }
  .ticket-sidebar-col { flex-direction: row; flex-wrap: wrap; }
  .ticket-sidebar-col .card { flex: 1 1 260px; }
}

@media (max-width: 640px) {
  .reply-bubble { max-width: 95%; }
  .ticket-sidebar-col { flex-direction: column; }
}

/* Login/setup pages: floating theme toggle in top-right corner */
.login-theme-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 100;
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 900px) {
  .content-grid, .project-details { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .container { padding: 1rem; }
  .admin-header-inner { padding: 0.75rem 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
  .card-header { flex-wrap: wrap; }
  .file-item { flex-direction: column; align-items: flex-start; gap: 0.75rem; padding: 1rem 1.5rem; }
  .file-meta { flex-direction: row; align-items: center; }
  .modal-content { padding: 1.5rem; border-radius: var(--radius-xl); }
  table { font-size: 0.8125rem; }
  table thead th, table tbody td { padding: 0.625rem 0.875rem; }
}

@media (max-width: 480px) {
  .stats-grid, .quick-actions { grid-template-columns: 1fr; }
  .login-card, .setup-card { padding: 1.75rem; }
  .upload-page-header { flex-direction: column; text-align: center; }
}
