:root {
  --bg: #0a0e14;
  --bg-elevated: #11161f;
  --bg-card: #161c27;
  --border: #232b3a;
  --text: #e6edf3;
  --text-dim: #8b97a8;
  --accent: #ff6b35;
  --accent-hot: #ff8a5c;
  --accent-glow: rgba(255, 107, 53, 0.35);
  --cyan: #4cc9f0;
  --danger: #ff4d6d;
  --success: #4ade80;
  --radius: 10px;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Build-plate grid background */
.grid-bg {
  background-image:
    linear-gradient(rgba(76, 201, 240, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 201, 240, 0.04) 1px, transparent 1px),
    radial-gradient(ellipse at top, rgba(255, 107, 53, 0.08), transparent 60%);
  background-size: 32px 32px, 32px 32px, 100% 100%;
}

/* ===== Auth (login) ===== */
.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  gap: 1.5rem;
}

.brand {
  text-align: center;
  margin-bottom: 0.5rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
}

.logo h1 {
  font-family: var(--mono);
  font-size: 1.6rem;
  letter-spacing: 0.12em;
  margin: 0;
  font-weight: 700;
}

/* Stacked-layer logo mark */
.logo-layers {
  display: inline-block;
  position: relative;
  width: 36px;
  height: 36px;
}
.logo-layers span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  border-radius: 2px;
  box-shadow: 0 0 12px var(--accent-glow);
}
.logo-layers span:nth-child(1) { bottom: 4px;  width: 30px; height: 5px; opacity: 1;    }
.logo-layers span:nth-child(2) { bottom: 11px; width: 26px; height: 5px; opacity: 0.85; }
.logo-layers span:nth-child(3) { bottom: 18px; width: 22px; height: 5px; opacity: 0.7;  }
.logo-layers span:nth-child(4) { bottom: 25px; width: 18px; height: 5px; opacity: 0.55; }
.logo-layers.small { width: 24px; height: 24px; }
.logo-layers.small span:nth-child(1) { bottom: 2px;  width: 20px; height: 3px; }
.logo-layers.small span:nth-child(2) { bottom: 7px;  width: 17px; height: 3px; }
.logo-layers.small span:nth-child(3) { bottom: 12px; width: 14px; height: 3px; }
.logo-layers.small span:nth-child(4) { bottom: 17px; width: 11px; height: 3px; }

.tagline {
  color: var(--text-dim);
  font-family: var(--mono);
  margin: 0.4rem 0 0;
  font-size: 0.85rem;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 420px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 40px rgba(0, 0, 0, 0.4);
  position: relative;
}

.card::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: var(--radius);
  padding: 1px;
  background: linear-gradient(135deg, transparent 40%, rgba(255, 107, 53, 0.25), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

.card h2 {
  margin: 0 0 1.25rem;
  font-family: var(--mono);
  font-size: 1.1rem;
  letter-spacing: 0.05em;
}

/* ===== Forms ===== */
label {
  display: block;
  margin-bottom: 1rem;
}

label > span {
  display: block;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
  font-family: var(--mono);
}

input[type="email"],
input[type="password"],
textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 0.7rem 0.85rem;
  font-family: var(--sans);
  font-size: 0.95rem;
  transition: border 0.15s, box-shadow 0.15s;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

textarea { resize: vertical; min-height: 90px; }

.btn-primary {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-hot), var(--accent));
  color: #1a0c04;
  border: 0;
  border-radius: 6px;
  padding: 0.85rem 1rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: 0.06em;
  cursor: pointer;
  font-size: 0.9rem;
  text-transform: uppercase;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 0 0 1px var(--accent),
    0 6px 20px rgba(255, 107, 53, 0.3);
  transition: transform 0.05s, box-shadow 0.15s, filter 0.15s;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: color 0.15s, border-color 0.15s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--accent); }

.error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0.75rem 0 0;
  font-family: var(--mono);
}

.status {
  margin: 0.75rem 0 0;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.status.success { background: rgba(74, 222, 128, 0.1); color: var(--success); border: 1px solid rgba(74, 222, 128, 0.3); }
.status.error   { background: rgba(255, 77, 109, 0.1); color: var(--danger);  border: 1px solid rgba(255, 77, 109, 0.3); }
.status.info    { background: rgba(76, 201, 240, 0.1); color: var(--cyan);    border: 1px solid rgba(76, 201, 240, 0.3); }

.footer { color: var(--text-dim); font-size: 0.8rem; }
.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { text-decoration: underline; }

/* ===== App page ===== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--mono);
  letter-spacing: 0.08em;
}

.user-info { display: flex; align-items: center; gap: 0.85rem; }
.user-email {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 0.8rem;
}

.app-shell {
  max-width: 640px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.app-shell .card { max-width: none; }

.quota-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 0.4rem 1rem;
  align-items: center;
}

.quota-label {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  grid-column: 1;
}

.quota-number {
  font-family: var(--mono);
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--accent);
  grid-column: 2;
  grid-row: 1 / span 2;
  line-height: 1;
  text-shadow: 0 0 18px var(--accent-glow);
}

.quota-bar {
  grid-column: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 4px;
  overflow: hidden;
}
.quota-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hot));
  width: 0%;
  transition: width 0.4s;
}

/* ===== File upload ===== */
.file-label > input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-label { position: relative; }

.file-drop {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--bg-elevated);
}
.file-drop:hover, .file-drop.dragover {
  border-color: var(--accent);
  background: rgba(255, 107, 53, 0.05);
}
.file-drop-text { display: block; color: var(--text); font-size: 0.9rem; }
.file-drop-hint { display: block; color: var(--text-dim); font-size: 0.75rem; margin-top: 0.3rem; font-family: var(--mono); }

.file-preview {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-elevated);
}
.file-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

@media (max-width: 520px) {
  .topbar { padding: 0.75rem 1rem; }
  .user-email { display: none; }
  .quota-number { font-size: 2.1rem; }
}
