/* =========================================================
   Crewland · app pages (login, account, admin)
   Builds on styles.css tokens.
   ========================================================= */
[hidden] { display: none !important; }
.app-body { min-height: 100vh; display: flex; flex-direction: column; }
.app-nav { border-bottom: 1px solid var(--line); }
.app-nav .nav__inner { height: 68px; }
.app-nav__right { display: flex; align-items: center; gap: 18px; }
.app-nav__right a, .linkish {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-soft); background: none; border: 0; cursor: pointer; padding: 0; font-weight: 600; }
.app-nav__right a:hover, .linkish:hover { color: var(--red); }
.app-main { flex: 1; padding: 56px 0 90px; }
.app-main .container { max-width: 1060px; }

/* ---------- auth card ---------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; max-width: 1000px; margin: 0 auto; }
.auth__pitch h1 { font-size: clamp(48px, 6vw, 84px); line-height: .92; margin-bottom: 22px; }
.auth__pitch h1 em { display: block; font-size: .85em; }
.auth__pitch p { color: var(--text-soft); max-width: 420px; }
.auth__perks { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.auth__perks li { position: relative; padding-left: 26px; }
.auth__perks li::before { content: "✦"; position: absolute; left: 0; color: var(--red); }
.card {
  background: var(--bg-2);
  border: 2px solid var(--cream);
  box-shadow: 10px 10px 0 var(--red);
  padding: 34px;
}
.tabs { display: grid; grid-template-columns: 1fr 1fr; margin: -34px -34px 28px; border-bottom: 2px solid var(--cream); }
.tabs button {
  padding: 16px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-faint);
  font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.tabs button + button { border-left: 2px solid var(--cream); }
.tabs button[aria-selected="true"] { background: var(--cream); color: var(--bg); }
.stack { display: grid; gap: 16px; }
.msg { font-size: 14px; padding: 12px 14px; border-left: 3px solid var(--red); background: rgb(var(--red-rgb) / .08); color: var(--text); }
.msg--ok { border-left-color: #2ee6a8; background: rgba(46,230,168,.08); }
.help { font-size: 13px; color: var(--text-faint); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- account ---------- */
.status {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 18px 22px; margin-bottom: 36px;
  border: 2px dashed rgba(241,233,220,.3);
}
.status__pill { font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 5px 9px; background: var(--red); color: var(--bg); }
.status p { color: var(--text-soft); flex: 1; min-width: 220px; }
.meter { width: 160px; height: 8px; background: var(--card); border: 1px solid var(--line-2); }
.meter span { display: block; height: 100%; background: var(--red); transition: width .4s var(--ease); }
.meter-label { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); font-weight: 600; }

.account { display: grid; grid-template-columns: 340px 1fr; gap: 48px; align-items: start; }
.preview { position: sticky; top: 24px; }
.preview .label { margin-bottom: 12px; }
.pcard { background: var(--card); border: 1px solid var(--line-2); box-shadow: 10px 10px 0 var(--red); transform: rotate(-1deg); }
.pcard__cover { height: 96px; background: linear-gradient(150deg, var(--red), var(--red-deep)); position: relative; }
.pcard__avatar {
  position: absolute; left: 20px; bottom: -38px;
  width: 84px; height: 84px; border-radius: 50%;
  border: 3px solid var(--card); background: var(--bg-2) center / cover no-repeat;
  display: grid; place-items: center;
  font-family: var(--font-head); font-size: 34px; color: var(--cream); font-weight: 700; }
.pcard__body { padding: 50px 20px 22px; }
.pcard__name { font-family: var(--font-head); font-size: 30px; line-height: 1; font-weight: 700; }
.pcard__handle { font-family: var(--font-mono); font-size: 13px; color: var(--red); margin: 6px 0 12px; font-weight: 600; }
.pcard__craft { display: inline-block; font-family: var(--font-mono); font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 4px 8px; background: var(--cream); color: var(--bg); margin: 0 6px 6px 0; }
.pcard__craft--alt { background: transparent; color: var(--cream); border: 1px solid var(--line-2); }
.pcard__bio { color: var(--text-soft); font-size: 15px; margin-top: 10px; white-space: pre-wrap; }
.pcard__meta { margin-top: 14px; font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); display: flex; gap: 14px; flex-wrap: wrap; font-weight: 600; }
.pcard__collab { color: #2ee6a8; }

.editor h2 { font-size: 40px; line-height: 1; margin-bottom: 6px; }
.fieldset { border: 0; padding: 0; margin: 0 0 34px; display: grid; gap: 16px; }
.fieldset legend { font-family: var(--font-mono); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--red); margin-bottom: 14px; padding: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field textarea {
  width: 100%; min-height: 110px; resize: vertical;
  padding: 14px 16px; background: var(--bg); border: 1.5px solid var(--line-2); border-radius: 4px;
  color: var(--text); font: 400 16px/1.5 var(--font-body);
}
.field textarea:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px rgb(var(--red-rgb) / .25); }
.handle-input { position: relative; }
.handle-input span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--text-faint); }
.handle-input input { padding-left: 32px !important; }
.handle-status { font-size: 13px; min-height: 18px; }
.handle-status.ok { color: #2ee6a8; }
.handle-status.bad { color: var(--red-hi); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { cursor: pointer; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips span {
  display: inline-block; padding: 8px 12px;
  border: 1.5px solid var(--line-2);
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase;
  color: var(--text-soft);
  transition: background .15s, color .15s, border-color .15s; font-weight: 600; }
.chips input:checked + span { background: var(--cream); color: var(--bg); border-color: var(--cream); }
.chips input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.avatar-row { display: flex; align-items: center; gap: 18px; }
.avatar-row .pcard__avatar { position: static; width: 72px; height: 72px; font-size: 28px; border-color: var(--line-2); }
.toggle { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--red); }
.save-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 0; background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.save-bar .help { flex: 1; }
.counter { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); text-align: right; font-weight: 600; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.7); }
.modal[hidden] { display: none; }
.modal .card { width: 100%; max-width: 420px; }

/* ---------- admin ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 40px; }
.stat { padding: 20px; background: var(--card); border: 1px solid var(--line-2); }
.stat b { display: block; font-family: var(--font-head); font-size: 52px; line-height: 1; font-weight: 700; }
.stat span { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; color: var(--text-faint); font-weight: 600; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input { flex: 1; min-width: 200px; padding: 12px 14px; background: var(--bg); border: 1.5px solid var(--line-2); border-radius: 4px; color: var(--text); font: 400 15px var(--font-body); }
.toolbar input:focus { outline: none; border-color: var(--red); }
.btn--ghost { background: transparent; color: var(--cream); }
.subtabs { display: flex; gap: 0; margin-bottom: 18px; border: 2px solid var(--cream); width: max-content; max-width: 100%; }
.subtabs button { padding: 10px 18px; background: transparent; border: 0; color: var(--text-faint); font-family: var(--font-head); font-size: 18px; cursor: pointer; font-weight: 700; }
.subtabs button + button { border-left: 2px solid var(--cream); }
.subtabs button[aria-selected="true"] { background: var(--cream); color: var(--bg); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line-2); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); background: var(--bg-2); position: sticky; top: 0; white-space: nowrap; font-weight: 600; }
td a { color: var(--red-hi); word-break: break-all; }
tr:hover td { background: rgba(241,233,220,.03); }
.mini-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--card) center / cover; display: inline-grid; place-items: center; font-family: var(--font-head); font-size: 13px; vertical-align: middle; margin-right: 8px; font-weight: 700; }
.empty { padding: 40px; text-align: center; color: var(--text-faint); }
.crafts-bar { display: grid; gap: 8px; margin-bottom: 40px; }
.crafts-bar div { display: grid; grid-template-columns: 150px 1fr 40px; gap: 12px; align-items: center; font-size: 14px; }
.crafts-bar i { display: block; height: 10px; background: var(--red); }
.crafts-bar span:last-child { font-family: var(--font-mono); font-size: 12px; color: var(--text-soft); text-align: right; font-weight: 600; }

.center-note { max-width: 520px; margin: 60px auto; text-align: center; }
.center-note h1 { font-size: 56px; line-height: .95; margin-bottom: 14px; }
.center-note p { color: var(--text-soft); margin-bottom: 26px; }

@media (max-width: 900px) {
  .auth, .account { grid-template-columns: 1fr; gap: 40px; }
  .preview { position: static; max-width: 380px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .app-main { padding: 36px 0 70px; }
  /* phones: get the sign-up form on the first screen */
  .auth { gap: 22px; }
  .auth__pitch h1 { font-size: 44px; margin-bottom: 10px; }
  .auth__pitch h1 em { display: inline; }
  .auth__pitch .label, .auth__perks { display: none; }
  .card { padding: 24px 20px; box-shadow: 7px 7px 0 var(--red); }
  .tabs { margin: -24px -20px 24px; }
  .grid-2 { grid-template-columns: 1fr; }
  .crafts-bar div { grid-template-columns: 110px 1fr 30px; }
  .app-nav__right { gap: 12px; }
}

/* ---------- Crewland dialogs (confirm / notice) ---------- */
.cdialog { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: cd-fade .18s ease both; }
.cdialog.is-leaving { animation: cd-fade .16s ease reverse both; }
.cdialog.is-leaving .cdialog__card { animation: cd-pop .16s ease reverse both; }
.cdialog__card {
  width: 100%; max-width: 400px; padding: 28px 26px 22px; text-align: center;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 26px;
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.7);
  animation: cd-pop .26s cubic-bezier(.16, 1, .3, 1) both;
}
.cdialog__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 18px; margin-bottom: 16px; background: color-mix(in srgb, var(--text) 8%, transparent); color: var(--text); }
.cdialog__icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cdialog--danger .cdialog__icon, .cdialog--block .cdialog__icon { background: rgba(255, 77, 77, .14); color: #ff5a5a; }
.cdialog__card h2 { font-family: var(--font-head); font-size: 30px; line-height: 1.02; margin-bottom: 8px; overflow-wrap: anywhere; font-weight: 700; }
.cdialog__card p { color: var(--text-soft); font-size: 15px; margin-bottom: 20px; }
.cdialog__card p[hidden] + .cdialog__actions { margin-top: 18px; }
.cdialog__actions { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.cdialog__actions .btn { width: 100%; }
.btn--danger { background: linear-gradient(180deg, #ff6b6b, #e03131) !important; color: #fff !important; box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -3px 0 rgba(120,0,0,.25), 0 10px 24px -10px rgba(224,49,49,.7) !important; }
:root[data-style="glass"] .cdialog__card { background: var(--glass-strong); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-color: var(--glass-line); }
@keyframes cd-fade { from { opacity: 0; } }
@keyframes cd-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@media (max-width: 480px) {
  .cdialog { align-items: end; padding: 12px; }
  .cdialog__card { border-radius: 26px; padding-bottom: 18px; }
}
