:root {
  --night: #0f1424;
  --deep: #141a2b;
  --panel: rgba(22, 29, 48, 0.86);
  --panel-solid: #182036;
  --raised: #1f2842;
  --line: rgba(227, 192, 111, 0.16);
  --line-soft: rgba(255, 255, 255, 0.07);
  --ink: #f1ece4;
  --muted: #a7adbf;
  --faint: #6f7690;
  --gold: #e3c06f;
  --gold-deep: #c9a24f;
  --danger: #e07a6c;
  --ok: #8cc79a;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Hanken Grotesk", system-ui, sans-serif;
  --radius: 4px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--sans);
  font-size: 15px;
  color: var(--ink);
  background: var(--night);
  line-height: 1.5;
}

/* The night sky behind every page; assets/castle.jpg (the website's hero picture) shows through when present. */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(15, 20, 36, 0.96) 0%, rgba(15, 20, 36, 0.78) 45%, rgba(15, 20, 36, 0.55) 100%),
    url("castle.jpg") center / cover no-repeat,
    radial-gradient(ellipse at 70% 10%, #3b4a6d 0%, #1b2338 45%, #0f1424 80%);
}
body.state-app .sky {
  background:
    linear-gradient(180deg, rgba(15, 20, 36, 0.9) 0%, rgba(15, 20, 36, 0.97) 60%),
    url("castle.jpg") center / cover no-repeat,
    radial-gradient(ellipse at 70% 0%, #2c3958 0%, #161d31 50%, #0f1424 85%);
}

a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; margin: 0; letter-spacing: 0.01em; }

/* ---- Top bar ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 26px 56px;
}
.brand { font-family: var(--serif); font-size: 30px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 34px; margin-left: auto; }
.nav a, .eyebrow, .label-caps {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
}
.nav a { color: var(--ink); opacity: 0.85; padding: 6px 0; border-bottom: 1px solid transparent; }
.nav a:hover { opacity: 1; }
.nav a.active { color: var(--gold); opacity: 1; border-bottom-color: var(--gold); }
.account { display: flex; align-items: center; gap: 18px; }
.state-pending .topbar form { margin-left: auto; }
.me { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 600; }
.me img, .avatar { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); object-fit: cover; }
.avatar.sm { width: 24px; height: 24px; }
.avatar.lg { width: 96px; height: 96px; }
.link { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.link:hover { color: var(--ink); }

/* ---- Landing and waiting pages ---- */
.hero { padding: 9vh 56px 0; max-width: 900px; }
.eyebrow { color: var(--gold); display: flex; align-items: center; gap: 18px; margin: 0 0 18px; }
.eyebrow::before { content: ""; width: 48px; height: 1px; background: var(--gold); }
.hero h1 { font-size: clamp(54px, 8vw, 104px); line-height: 0.98; margin-bottom: 28px; }
.lede { font-size: 22px; color: #dcd7cf; max-width: 640px; margin: 0 0 36px; }
.hero-actions { display: flex; gap: 14px; }

/* ---- Buttons and fields ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: transparent;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { border-color: var(--gold); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #1a1a1a; }
.btn-gold:hover { background: #ecce86; }
.hero .btn { padding: 18px 44px; font-size: 18px; }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.danger { border-color: rgba(224, 122, 108, 0.45); color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }

input[type=text], input[type=date], input[type=color], textarea, select {
  background: rgba(10, 14, 26, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 9px 11px;
  width: 100%;
}
input[type=color] { padding: 2px; height: 38px; width: 56px; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); }
textarea { min-height: 110px; resize: vertical; }
label.field { display: block; margin-bottom: 14px; }
label.field > span { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.spacer { margin-left: auto; }

/* ---- Pages ---- */
.view { padding: 8px 56px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 18px 0 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 52px; line-height: 1; }
.page-head .eyebrow { margin-bottom: 10px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.empty { color: var(--muted); padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius); text-align: center; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; backdrop-filter: blur(6px); }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.section-title { font-family: var(--serif); font-size: 28px; margin: 34px 0 14px; }

/* Project tiles */
.project-tile { display: block; text-decoration: none; border-top: 3px solid var(--tile, var(--gold)); }
.project-tile:hover { border-color: var(--gold); }
.project-tile h3 { font-size: 26px; margin-bottom: 6px; }
.progress { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 2px; overflow: hidden; margin: 14px 0 10px; }
.progress > i { display: block; height: 100%; background: var(--gold); }
.faces { display: flex; }
.faces img { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--panel-solid); margin-right: -6px; }

/* ---- Board ---- */
.board-head { display: flex; align-items: center; gap: 14px; margin: 12px 0 18px; flex-wrap: wrap; }
.board-head h1 { font-size: 44px; }
.board-filters { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.board-filters input[type=text] { width: 240px; }
.board-filters select { width: auto; min-width: 160px; }
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 20px; min-height: 60vh; }
.column {
  flex: 0 0 300px;
  background: rgba(18, 24, 40, 0.88);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 230px);
}
.column.done-col { border-color: rgba(140, 199, 154, 0.25); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: grab; }
.column-head h3 { font-family: var(--sans); font-size: 12.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.column-head .count { color: var(--faint); font-size: 13px; }
.column-cards { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 40px; flex: 1; }
.column.drop-target .column-cards { background: rgba(227, 192, 111, 0.05); }
.column-foot { padding: 8px 10px 12px; }
.add-card { width: 100%; text-align: left; color: var(--muted); background: none; border: 1px dashed transparent; padding: 7px 8px; cursor: pointer; border-radius: var(--radius); }
.add-card:hover { border-color: var(--line); color: var(--ink); }
.add-column { flex: 0 0 260px; }

.card {
  background: var(--raised);
  border: 1px solid var(--line-soft);
  border-left: 3px solid transparent;
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}
.card:hover { border-color: rgba(227, 192, 111, 0.4); }
.card.dragging { opacity: 0.4; }
.card.done .card-title { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.25); }
.card-title { font-weight: 600; margin: 4px 0 8px; word-break: break-word; }
.card-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.card-meta .faces { margin-left: auto; }
.chip { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; color: #11131c; margin: 0 4px 4px 0; }
.due { padding: 1px 6px; border-radius: 3px; }
.due.soon { background: rgba(227, 192, 111, 0.18); color: var(--gold); }
.due.late { background: rgba(224, 122, 108, 0.18); color: var(--danger); }
.due.met { background: rgba(140, 199, 154, 0.15); color: var(--ok); }
.drop-line { height: 3px; background: var(--gold); border-radius: 2px; }
.project-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ---- Card dialog ---- */
.modal { position: fixed; inset: 0; background: rgba(5, 8, 16, 0.7); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 20px; overflow-y: auto; z-index: 20; }
.modal[hidden] { display: none; }
.dialog { width: min(980px, 100%); background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 30px; position: relative; }
.dialog.narrow { width: min(560px, 100%); }
.dialog .close { position: absolute; top: 14px; right: 16px; font-size: 26px; line-height: 1; }
.dialog-title { font-family: var(--serif); font-size: 34px; font-weight: 500; background: transparent; border: 1px solid transparent; padding: 2px 6px; margin-left: -7px; width: calc(100% - 30px); }
.dialog-title:hover { border-color: var(--line-soft); }
.dialog-body { display: grid; grid-template-columns: 1fr 260px; gap: 30px; margin-top: 18px; }
.dialog h4 { font-size: 12.5px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--gold); margin: 22px 0 10px; }
.dialog h4:first-child { margin-top: 0; }
.description { white-space: pre-wrap; word-break: break-word; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); min-height: 48px; cursor: text; }
.description:empty::before { content: "No description."; color: var(--faint); }
.check-item { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.check-item input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--gold); }
.check-item.done span { color: var(--muted); text-decoration: line-through; }
.check-item span { flex: 1; word-break: break-word; }
.check-item .link { visibility: hidden; }
.check-item:hover .link { visibility: visible; }
.comment { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-soft); }
.comment .body { white-space: pre-wrap; word-break: break-word; margin-top: 2px; }
.file { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.file img { width: 64px; height: 48px; object-fit: cover; border-radius: 3px; }
.file .icon { width: 64px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line-soft); border-radius: 3px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.drop-zone { border: 1px dashed var(--line); padding: 14px; text-align: center; color: var(--muted); border-radius: var(--radius); cursor: pointer; }
.drop-zone.over { border-color: var(--gold); color: var(--ink); }
.side-box { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.pick input { accent-color: var(--gold); }
.activity { font-size: 13px; color: var(--muted); padding: 3px 0; }

/* ---- Lists and tables ---- */
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-top: 1px solid var(--line-soft); }
.list-row:first-child { border-top: 0; }
.list-row .title { font-weight: 600; }
.list-row select { width: auto; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; padding: 2px 8px; border-radius: 2px; border: 1px solid var(--line); color: var(--muted); }
.tag.gold { color: var(--gold); border-color: rgba(227, 192, 111, 0.5); }
.tag.warn { color: var(--danger); border-color: rgba(224, 122, 108, 0.5); }

/* ---- Profile ---- */
.profile-head { display: flex; gap: 26px; align-items: center; }
.profile-head h1 { font-size: 48px; line-height: 1.05; }
.stats { display: flex; gap: 14px; margin-top: 20px; flex-wrap: wrap; }
.stat { padding: 14px 20px; border: 1px solid var(--line); border-radius: var(--radius); min-width: 130px; }
.stat b { display: block; font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1; }
.stat span { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--panel-solid); border: 1px solid var(--gold); padding: 10px 18px; border-radius: var(--radius); z-index: 30; }
.toast.error { border-color: var(--danger); }

@media (max-width: 900px) {
  .topbar { padding: 18px 20px; gap: 16px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; gap: 20px; margin: 0; overflow-x: auto; }
  .account { margin-left: auto; }
  .me span { display: none; }
  .view, .hero { padding-left: 20px; padding-right: 20px; }
  .dialog-body { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 40px; }
}
