:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --bg-main: #f8fafc;
  --bg-admin: #f1f5f9;
  --bg-sidebar: #0f172a;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1 {
  margin-bottom: 20px;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 700;
}

h2 {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 700;
}

.page-heading h1 {
  margin-bottom: 8px;
}

.page-heading p {
  color: var(--text-muted);
  font-size: 14px;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(circle at 20% 10%, rgba(79, 70, 229, 0.12), transparent 28%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.auth-panel {
  width: min(460px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  font-size: 12px;
  font-weight: 700;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

input,
select,
textarea {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text-main);
  font: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f1f5f9;
  color: var(--text-muted);
  cursor: not-allowed;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--primary);
  color: white;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

button:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.secondary,
.ghost {
  background: white;
  border-color: var(--border);
  color: #334155;
}

.secondary:hover:not(:disabled),
.ghost:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.alert {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
}

.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar strong {
  font-size: 18px;
  font-weight: 700;
}

.topbar span {
  color: var(--text-muted);
  font-size: 14px;
}

.logo-area,
.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-tag {
  background: linear-gradient(135deg, #6366f1, #a855f7);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.brand-title {
  color: var(--text-main);
  font-size: 18px;
  font-weight: 700;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

.page {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
}

.submission-layout {
  display: grid;
  grid-template-columns: 1fr 2.5fr;
  gap: 30px;
}

.side-panel,
.content-panel,
.field-box,
.project-card,
.metric,
.data-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.side-panel,
.content-panel,
.field-box,
.project-card,
.metric {
  padding: 24px;
}

.content-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-box {
  background: #fbfdff;
}

.field-box h2,
.content-panel h2 {
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 16px;
  font-weight: 700;
}

.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.form-hint {
  margin-top: -6px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  margin: 4px 0 14px;
  padding: 6px 12px;
  border-radius: 20px;
  background: #ecfdf5;
  color: #047857;
  font-size: 14px;
  font-weight: 600;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 140px;
  color: inherit;
}

.project-card span,
.project-card small {
  color: var(--text-muted);
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
}

.checkbox-row input {
  width: auto;
  margin-top: 3px;
}

.announcement-box {
  margin-top: 12px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 260px;
  background: var(--bg-sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 36px;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 800;
}

.sidebar-brand span {
  background: var(--primary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-item {
  color: #94a3b8;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
}

.menu-item:hover {
  background: #1e293b;
  color: white;
  text-decoration: none;
}

.admin-topbar {
  margin-left: 260px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.admin-topbar strong {
  font-size: 18px;
  font-weight: 700;
}

.admin-topbar span {
  margin-left: 12px;
  color: var(--text-muted);
  font-size: 14px;
}

.admin-header {
  margin-left: 260px;
}

.admin-page {
  min-height: calc(100vh - 65px);
  margin-left: 260px;
  padding: 30px 40px;
  background: var(--bg-admin);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
}

.metric {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.metric span {
  color: var(--text-muted);
  font-size: 13px;
}

.metric strong {
  color: var(--text-main);
  font-size: 26px;
  font-weight: 800;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}

.inline-form input,
.inline-form select {
  width: auto;
  min-width: 180px;
  margin-top: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
  overflow: hidden;
}

.data-table th {
  background: #f8fafc;
  padding: 12px 16px;
  font-weight: 700;
  color: #475569;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: #334155;
  vertical-align: middle;
}

.data-table tr:hover {
  background: #f8fafc;
}

.table-action {
  display: inline-flex;
  margin: 0;
}

.table-action button {
  min-height: 32px;
  padding: 6px 12px;
  font-size: 12px;
}

.admin-page .content-panel {
  margin-bottom: 20px;
}

.admin-page > .form-stack,
.admin-page > .inline-form,
.admin-page > .data-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.admin-page > .form-stack {
  padding: 24px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.export-card {
  min-height: 190px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: inherit;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.export-card:hover {
  transform: translateY(-2px);
  border-color: #c7d2fe;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  text-decoration: none;
}

.export-card-primary {
  grid-column: span 2;
  background:
    linear-gradient(135deg, rgba(79, 70, 229, 0.08), rgba(16, 185, 129, 0.08)),
    var(--bg-card);
  border-color: #c7d2fe;
}

.export-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.file-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.file-pill.zip {
  background: #d1fae5;
  color: #047857;
}

.export-card strong {
  color: var(--text-main);
  font-size: 18px;
  line-height: 1.3;
}

.export-card p {
  flex: 1;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.export-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  min-height: 34px;
  padding: 8px 14px;
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
}

.export-card-primary .export-action {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

@media (max-width: 900px) {
  .submission-layout {
    grid-template-columns: 1fr;
  }

  .metric-grid,
  .export-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .export-card-primary {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .topbar {
    padding: 16px 20px;
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar span {
    display: block;
    margin: 6px 0 0;
  }

  .sidebar {
    position: static;
    width: auto;
    min-height: auto;
  }

  .admin-topbar,
  .admin-header,
  .admin-page {
    margin-left: 0;
  }

  .admin-page {
    padding: 24px 16px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .export-grid {
    grid-template-columns: 1fr;
  }

  .export-card-primary {
    grid-column: span 1;
  }

  .inline-form input,
  .inline-form select {
    width: 100%;
  }
}
