:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --error: #f87171;
  --warning: #fbbf24;
  --success: #4ade80;
  --radius: 12px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: radial-gradient(ellipse 120% 80% at 50% -20%, #1e3a5f 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.5;
}

.wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem;
}

.wrap-guest {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 4rem);
  max-width: 480px;
}

header {
  margin-bottom: 2rem;
}

header h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35);
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
}

.flash.error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.flash.warning {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.flash.success {
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  color: #bbf7d0;
}

.field {
  margin-bottom: 1.25rem;
}

.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field .form-control,
.field textarea,
.field select {
  display: block;
  width: 100%;
  max-width: 100%;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none;
  appearance: none;
}

.field input:focus,
.field .form-control:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.field textarea {
  min-height: 140px;
  resize: vertical;
}

.file-drop {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 1.5rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.file-drop:hover,
.file-drop.dragover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.08);
}

.file-drop input {
  display: none;
}

.file-drop strong {
  display: block;
  margin-bottom: 0.25rem;
}

.file-list {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: left;
}

.file-list li {
  margin: 0.25rem 0;
}

.file-list .bad {
  color: var(--error);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 560px) {
  .row-2 {
    grid-template-columns: 1fr;
  }
}

.priority-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.priority-option {
  flex: 1;
  min-width: 100px;
}

.priority-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.priority-option label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  transition: border-color 0.15s, transform 0.1s;
}

.priority-option input:checked + label {
  border-color: currentColor;
  transform: scale(1.02);
}

.priority-option.red label {
  color: #f87171;
}

.priority-option.orange label {
  color: #fb923c;
}

.priority-option.green label {
  color: #4ade80;
}

.priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.actions {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-primary {
  width: 100%;
  padding: 0.9rem 1.25rem;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: #fff;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-hover) 100%);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.success-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(74, 222, 128, 0.15);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1rem;
}

.meta {
  font-size: 0.9rem;
  color: var(--muted);
}

.meta dt {
  font-weight: 600;
  color: var(--text);
  margin-top: 0.75rem;
}

.meta dd {
  margin: 0.15rem 0 0;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.red {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
}

.badge.orange {
  background: rgba(234, 88, 12, 0.2);
  color: #fdba74;
}

.badge.green {
  background: rgba(22, 163, 74, 0.2);
  color: #86efac;
}

.link-back {
  display: inline-block;
  margin-top: 1.5rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-back:hover {
  text-decoration: underline;
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.topbar {
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0.65rem 1.25rem;
}

.topbar-inner {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.topbar-user {
  font-size: 0.875rem;
  color: var(--muted);
}

.topbar-user strong {
  color: var(--text);
}

.logout-form {
  margin: 0;
}

.btn-ghost {
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-ghost:hover {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.1);
}

.wrap-authed {
  padding-top: 1.5rem;
}

.login-card {
  max-width: 420px;
  margin: 0 auto;
}

/* Sign-in page */
.auth-page {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 0 0.25rem;
}

.auth-logo {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 0 auto 1.75rem;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
}

.auth-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.auth-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-header p {
  margin: 0 auto;
  max-width: 34ch;
  color: var(--muted);
  font-size: clamp(0.875rem, 2.5vw, 0.95rem);
  line-height: 1.5;
}

.auth-flash {
  text-align: left;
  margin-bottom: 1rem;
}

.auth-card {
  width: 100%;
}

.auth-card .field {
  width: 100%;
}

.auth-actions {
  margin-top: 1.25rem;
  padding-top: 0;
  border-top: none;
}

.remember-row {
  margin-bottom: 0;
}

.remember-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  cursor: pointer;
}

.remember-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  accent-color: var(--accent);
}

@media (max-width: 480px) {
  .wrap {
    padding-top: 1.5rem;
    padding-bottom: 2.5rem;
  }

  .auth-logo {
    margin-bottom: 1.25rem;
  }

  .auth-card {
    padding: 1.35rem 1.15rem;
  }
}
