/* AVENOR customer portal
   ---------------------------------------------------------------------
   The palette below now matches the public site. It used to be a neutral
   grey (#0d0d0f) with a yellow gold (#d4a017), against the site's navy
   (#050810) and beige gold (#c8a46a) — so signing in felt like landing on
   a different company's product. Values mirror assets/css/avenor.css. */

:root {
  --p-bg:        #050810;
  --p-surface:   #0d1525;
  --p-surface-2: #121e30;
  --p-border:    rgba(200, 164, 106, .16);
  --p-fg:        #ece5d8;
  --p-muted:     #94aabb;
  --p-accent:    #c8a46a;
  --p-accent-2:  #e2c080;
  --p-danger:    #e88b8b;
  --p-ok:        #5dc48a;
  --p-radius:    10px;
  --p-shadow:    0 20px 60px rgba(0, 0, 0, .35);
}

/* Clients often open the portal on a phone in daylight, so it honours the
   same light theme the public site offers. */
:root[data-theme="light"] {
  --p-bg:        #f8f5ef;
  --p-surface:   #ffffff;
  --p-surface-2: #f1ece3;
  --p-border:    rgba(45, 55, 72, .16);
  --p-fg:        #111827;
  --p-muted:     #5c6879;
  --p-accent:    #8a6420;
  --p-accent-2:  #74521a;
  --p-danger:    #b02525;
  --p-ok:        #1f7a4d;
  --p-shadow:    0 20px 60px rgba(30, 35, 45, .08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.portal {
  font-family: 'DM Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--p-bg);
  color: var(--p-fg);
  line-height: 1.55;
  min-height: 100vh;
}

a { color: var(--p-accent); text-decoration: none; }
a:hover { color: var(--p-accent-2); }

/* ---------- Auth (login/register) shell ---------- */
.portal--auth {
  display: grid; place-items: center; min-height: 100vh;
  padding: 2rem 1rem;
}
.auth-shell { width: 100%; max-width: 440px; }
.auth-card {
  background: var(--p-surface);
  border: 1px solid var(--p-border);
  border-radius: var(--p-radius);
  padding: 2.5rem;
  box-shadow: var(--p-shadow);
}
.auth-brand {
  font-family: 'Syne', sans-serif; font-weight: 700;
  letter-spacing: .12em; color: var(--p-fg); font-size: .85rem;
}
.auth-card h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500; font-size: 2.25rem; margin: 1rem 0 .25rem;
}
.auth-sub { color: var(--p-muted); margin-top: 0; }
.auth-card form { display: grid; gap: 1rem; margin-top: 1.5rem; }
.auth-footer { color: var(--p-muted); text-align: center; margin-top: 1.5rem; font-size: .9rem; }

/* ---------- Header ---------- */
.portal-header {
  background: var(--p-surface);
  border-bottom: 1px solid var(--p-border);
  position: sticky; top: 0; z-index: 10;
}
.portal-header__inner {
  max-width: 1200px; margin: 0 auto; padding: 1rem 1.5rem;
  display: flex; align-items: center; gap: 2rem;
}
.portal-brand {
  font-family: 'Syne', sans-serif; font-weight: 700;
  letter-spacing: .12em; color: var(--p-fg) !important;
  font-size: .9rem;
}
.portal-brand span { color: var(--p-muted); font-weight: 400; }
.portal-nav { display: flex; gap: 1.25rem; flex: 1; }
.portal-nav a {
  color: var(--p-muted); font-size: .9rem; font-weight: 500;
  position: relative; padding: .25rem 0;
}
.portal-nav a:hover, .portal-nav a.is-active { color: var(--p-fg); }
.portal-nav a.is-active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -.6rem;
  height: 2px; background: var(--p-accent);
}
.portal-user { display: flex; align-items: center; gap: 1rem; font-size: .85rem; }
.portal-user__name { color: var(--p-fg); }
.portal-user__logout { color: var(--p-muted) !important; }
.portal-user__logout:hover { color: var(--p-fg) !important; }

/* ---------- Layout ---------- */
.portal-main { padding: 2.5rem 0 4rem; }
.portal-container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.portal-footer { border-top: 1px solid var(--p-border); padding: 1.5rem 0; color: var(--p-muted); font-size: .85rem; }

.welcome { margin-bottom: 2rem; }
.welcome h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500; font-size: 2.5rem; margin: 0 0 .25rem;
}
.welcome p { color: var(--p-muted); margin: 0; }

/* ---------- Stat cards ---------- */
.stats {
  display: grid; gap: 1rem; margin-bottom: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.stat-card {
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius); padding: 1.5rem;
}
.stat-card__value {
  font-family: 'Cormorant Garamond', serif; font-size: 2.5rem;
  line-height: 1; color: var(--p-accent);
}
.stat-card__label { color: var(--p-muted); font-size: .9rem; margin-top: .5rem; }
.stat-card__link { display: block; margin-top: .75rem; font-size: .85rem; }

/* ---------- Panels ---------- */
.panel {
  background: var(--p-surface); border: 1px solid var(--p-border);
  border-radius: var(--p-radius); padding: 2rem; margin-bottom: 2rem;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.panel h2 {
  font-family: 'Cormorant Garamond', serif; font-weight: 500;
  font-size: 1.5rem; margin: 0;
}
.panel h3 { font-size: 1.1rem; margin-top: 1.5rem; }
.muted { color: var(--p-muted); }
.small { font-size: .85rem; }

/* ---------- Forms ---------- */
label { display: grid; gap: .35rem; }
label > span { font-size: .85rem; color: var(--p-muted); }
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"],  input[type="number"], input[type="date"],
input[type="file"], select, textarea {
  background: var(--p-bg);
  border: 1px solid var(--p-border);
  color: var(--p-fg);
  border-radius: 8px;
  padding: .65rem .85rem;
  font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--p-accent);
}
input[disabled] { opacity: .6; }
textarea { resize: vertical; min-height: 80px; }
.form-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.form-grid .col-span { grid-column: 1 / -1; }
.form-grid button { justify-self: start; }
.upload-form { display: grid; gap: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  background: var(--p-surface-2); color: var(--p-fg);
  border: 1px solid var(--p-border);
  padding: .65rem 1.25rem; border-radius: 8px;
  font: inherit; font-weight: 500; cursor: pointer;
  text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--p-border); }
.btn--primary {
  background: var(--p-accent); color: #0d0d0f; border-color: var(--p-accent);
}
.btn--primary:hover { background: var(--p-accent-2); border-color: var(--p-accent-2); }
.btn--danger { background: var(--p-danger); border-color: var(--p-danger); color: #fff; }
.btn--small { padding: .35rem .75rem; font-size: .85rem; }

/* ---------- Alerts ---------- */
.alert {
  padding: .85rem 1rem; border-radius: 8px;
  margin-bottom: 1rem; background: var(--p-surface-2);
  border-left: 3px solid var(--p-muted);
}
.alert--ok  { border-left-color: var(--p-ok); }
.alert--err { border-left-color: var(--p-danger); }

/* ---------- Status badges ---------- */
.status {
  display: inline-block; padding: .2rem .65rem; border-radius: 999px;
  font-size: .75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em;
}
.status--lead       { background: rgba(154,154,163,.15); color: var(--p-muted); }
.status--active     { background: rgba(212,160,23,.18);  color: var(--p-accent); }
.status--review     { background: rgba(76,195,138,.18);  color: var(--p-ok); }
.status--paused     { background: rgba(154,154,163,.15); color: var(--p-muted); }
.status--completed  { background: rgba(76,195,138,.18);  color: var(--p-ok); }
.status--cancelled  { background: rgba(227,91,91,.18);   color: var(--p-danger); }

.badge {
  display: inline-block; padding: 0 .45rem;
  background: var(--p-accent); color: #0d0d0f;
  border-radius: 999px; font-size: .7rem; font-weight: 700;
  margin-left: .35rem; min-width: 18px; text-align: center;
}

/* ---------- Project list ---------- */
.project-list { list-style: none; padding: 0; margin: 0; }
.project-list__item {
  padding: 1rem 0; border-bottom: 1px solid var(--p-border);
}
.project-list__item:last-child { border-bottom: 0; }
.project-list__main {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  flex-wrap: wrap;
}
.project-list__title {
  font-family: 'Cormorant Garamond', serif; font-size: 1.25rem;
  color: var(--p-fg) !important;
}
.project-list__desc { color: var(--p-muted); margin: .5rem 0; }
.project-list__meta {
  display: flex; gap: 1rem; color: var(--p-muted); font-size: .85rem;
  flex-wrap: wrap; align-items: center; margin-top: .5rem;
}
.progress {
  display: inline-flex; align-items: center; gap: .5rem;
  width: 140px; position: relative;
}
.progress::before {
  content: ''; position: absolute; left: 0; right: 30px; height: 6px;
  background: var(--p-surface-2); border-radius: 3px; top: 50%;
  transform: translateY(-50%);
}
.progress__bar {
  position: absolute; left: 0; height: 6px;
  background: var(--p-accent); border-radius: 3px;
  top: 50%; transform: translateY(-50%);
  max-width: calc(100% - 30px);
}
.progress__num {
  margin-left: auto; font-size: .75rem; color: var(--p-fg); font-weight: 600;
}

/* ---------- Project detail ---------- */
.project-detail {
  display: grid; gap: 2rem;
  grid-template-columns: 2fr 1fr;
}
@media (max-width: 720px) { .project-detail { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1rem; margin: 0; }
.kv dt { color: var(--p-muted); font-size: .85rem; }
.kv dd { margin: 0; }
.milestones { list-style: none; padding: 0; margin: 1rem 0; }
.milestone {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center;
  gap: .5rem; padding: .5rem 0;
  border-bottom: 1px solid var(--p-border);
}
.milestone__check {
  width: 16px; height: 16px; border: 2px solid var(--p-border);
  border-radius: 4px;
}
.milestone.is-done .milestone__check {
  background: var(--p-ok); border-color: var(--p-ok);
}
.milestone.is-done .milestone__title { text-decoration: line-through; color: var(--p-muted); }
.milestone__date { color: var(--p-muted); font-size: .85rem; }

/* ---------- Chat ---------- */
.chat__thread {
  max-height: 480px; overflow-y: auto;
  display: grid; gap: 1rem; margin-bottom: 1.5rem;
  padding-right: .5rem;
}
.chat__msg {
  max-width: 75%; padding: .85rem 1rem;
  background: var(--p-surface-2); border-radius: 12px;
}
.chat__msg--mine {
  justify-self: end; background: var(--p-accent); color: #0d0d0f;
}
.chat__msg--theirs { justify-self: start; }
.chat__msg-meta {
  display: flex; justify-content: space-between; gap: 1rem;
  font-size: .75rem; opacity: .75; margin-bottom: .25rem;
}
.chat__msg-body { white-space: pre-wrap; word-wrap: break-word; }
.chat__form { display: grid; gap: .5rem; }
.chat__form textarea { background: var(--p-bg); }
.chat__form button { justify-self: end; }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: .75rem .85rem; text-align: left;
  border-bottom: 1px solid var(--p-border);
}
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--p-muted); }
.table tr:last-child td { border-bottom: 0; }

.file-list { list-style: none; padding: 0; margin: 0; }
.file-list__item {
  padding: .5rem 0; display: flex; justify-content: space-between; gap: 1rem;
  border-bottom: 1px solid var(--p-border);
}

.link { color: var(--p-accent); }


/* =====================================================================
   Focus + motion
   ---------------------------------------------------------------------
   The portal had no visible focus state, which matters more here than on
   the marketing pages: this is where clients download files and send
   messages, often by keyboard.
   ===================================================================== */

:focus-visible {
  outline: 2px solid var(--p-accent-2);
  outline-offset: 2px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: none;
  border-color: var(--p-accent);
  box-shadow: 0 0 0 3px rgba(200, 164, 106, .2);
}

.skip-link {
  position: absolute; left: 50%; top: 0;
  transform: translate(-50%, -150%);
  z-index: 100;
  background: var(--p-accent); color: #050810;
  font-family: 'Syne', sans-serif; font-size: .78rem; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  padding: 12px 24px; border-radius: 0 0 var(--p-radius) var(--p-radius);
  transition: transform .2s;
}
.skip-link:focus-visible { transform: translate(-50%, 0); }

/* Theme toggle, mirroring the one in the site header. */
.portal-theme {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 32px; margin-right: .5rem;
  border: 1px solid var(--p-border); border-radius: 100px;
  background: transparent; color: var(--p-fg);
  cursor: pointer; transition: border-color .25s, color .25s;
}
.portal-theme:hover { border-color: var(--p-accent); color: var(--p-accent); }
.portal-theme svg { width: 15px; height: 15px; }
.portal-theme .icon-sun { display: none; }
:root[data-theme="light"] .portal-theme .icon-sun { display: block; }
:root[data-theme="light"] .portal-theme .icon-moon { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
