/* 7Fabs Customer Portal V2 — clean, modern, simple, responsive for desktop and
   Android-sized screens. Theme-aware (light and dark), aligned with the 7Fabs
   public-site design language. */

:root {
  --bg: #f6f8fa;
  --surface: #ffffff;
  --ink: #101a26;
  --muted: #4f5b68;
  --line: #dde3ea;
  --brand: #1f5eae;
  --brand-hover: #16457f;
  --brand-ink: #ffffff;
  --lock: #93660f;
  --radius: 12px;
  --pad: 16px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --ink: #e8ebef;
    --muted: #9aa4b1;
    --line: #262c34;
    --brand: #4f8dff;
    --brand-hover: #79a9ff;
  }
}

* { box-sizing: border-box; }

/* Views are routed with the hidden attribute; keep it authoritative. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.app-shell {
  display: flex;
  flex-direction: column;
  max-width: 960px;
  min-height: 100vh;
  margin: 0 auto;
  padding: var(--pad);
}

header.portal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 14px;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 800;
  font-size: 0.95rem;
}

.brand-text strong { display: block; font-size: 1.05rem; line-height: 1.2; }
.brand-text small { display: block; color: var(--muted); font-size: 0.72rem; font-weight: 600; }

nav.portal-nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 14px;
  font-size: 0.95rem;
  font-weight: 600;
}
nav.portal-nav a:hover { color: var(--ink); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin: 14px 0;
}

.card--empty { text-align: center; }
.card--empty button { max-width: 20rem; margin-inline: auto; display: block; }

.view { width: 100%; max-width: 460px; margin: 24px auto; }
.view.wide { max-width: 100%; }

.view-heading, .section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.eyebrow { margin: 0 0 4px; color: var(--brand); font-size: 0.75rem; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; }
.button-link, .back-link { color: var(--brand); font-weight: 700; text-decoration: none; }
.button-link { display: inline-flex; align-items: center; min-height: 42px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 8px; }
.back-link { display: inline-block; margin-top: 10px; }
.status-banner { padding: 10px 12px; border-left: 3px solid var(--brand); background: var(--surface); color: var(--muted); font-size: 0.88rem; }

h1, h2 { margin: 0 0 10px; letter-spacing: -0.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; }
.muted { color: var(--muted); font-size: 0.92rem; }

label { display: block; font-size: 0.88rem; font-weight: 600; margin: 14px 0 5px; }

input[type="email"], input[type="password"], input[type="number"], input[type="file"], textarea {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font-size: 1rem;
}

input:focus, textarea:focus { border-color: var(--brand); }

button {
  margin-top: 16px;
  width: 100%;
  min-height: 44px;
  padding: 11px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: var(--brand-ink);
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
button:hover { background: var(--brand-hover); }
button.secondary {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--line);
}
button.secondary:hover { background: var(--bg); border-color: var(--brand); }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.project-card { position: relative; overflow: hidden; }
.project-thumbnail { display: grid; place-items: center; width: 100%; height: 96px; margin-bottom: 16px; border-radius: 8px; background: linear-gradient(135deg, var(--bg), var(--line)); color: var(--brand); font-weight: 800; font-size: 1.5rem; }
.project-facts { display: grid; grid-template-columns: minmax(7rem, 1fr) 1.4fr; gap: 6px 12px; margin: 16px 0; font-size: 0.86rem; }
.project-facts dt { color: var(--muted); }
.project-facts dd { margin: 0; text-align: right; font-weight: 650; overflow-wrap: anywhere; }
.project-card .row { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; margin: 3px 0; }
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--line);
  color: var(--muted);
}
.badge.locked { background: rgba(147, 102, 15, 0.16); color: var(--lock); }

.file-folder { border-top: 1px solid var(--line); padding: 10px 0; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 0; }
.file-row .name { overflow-wrap: anywhere; }
.file-row .muted { display: block; }
button.compact { width: auto; min-width: 7.5rem; margin: 0; }

.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0 6px; }
.metric-grid > div { padding: 12px; border-radius: 8px; background: var(--bg); }
.metric-grid strong { display: block; overflow-wrap: anywhere; }
.metric-label { display: block; color: var(--muted); font-size: 0.76rem; }

.gantt { display: grid; gap: 8px; margin-top: 14px; }
.gantt-row { display: grid; grid-template-columns: minmax(9rem, 1fr) 2fr; gap: 12px; align-items: center; padding: 12px; border-left: 5px solid var(--brand); border-radius: 6px; background: var(--bg); }

.message { max-width: 82%; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 4px 12px 12px; background: var(--bg); }
.message--customer { margin-left: auto; border-radius: 12px 4px 12px 12px; }
.message p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.message time { font-size: 0.75rem; }
.preview-title { display: block; margin-bottom: 8px; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 10px; padding: 7px 0; align-items: baseline; }
.timeline .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); flex: 0 0 auto; }
.timeline li.reached .dot { background: var(--brand); }

.unavailable {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px 16px;
  color: var(--muted);
  text-align: center;
  font-size: 0.92rem;
  background: var(--bg);
}

.notice { font-size: 0.84rem; color: var(--muted); margin-top: 8px; }
.notice a { color: var(--brand); font-weight: 600; }

.scroll-x { overflow-x: auto; max-width: 100%; }

.portal-footer {
  margin-top: auto;
  padding: 18px 0 6px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.portal-footer p { margin: 0; color: var(--muted); font-size: 0.84rem; }

@media (max-width: 520px) {
  .app-shell { padding: 12px; }
  .view { margin: 12px auto; }
  .brand-text small { display: none; }
  .view-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .gantt-row { grid-template-columns: 1fr; gap: 2px; }
  .file-row { align-items: flex-start; flex-direction: column; }
  button.compact { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; }
}
