/* Client portal. Readability: nothing under 16px, dark secondary text, white only on deep colours. */
[hidden] { display: none !important; }
.portal { padding-top: 1.25rem; font-family: var(--body); }
.portal h1 { font-size: 2rem; margin: .5rem 0 .5rem; }
.portal h2 { font-size: 1.5rem; margin: 1.75rem 0 .75rem; }
.portal h3 { font-size: 1.25rem; margin: 0 0 .5rem; }
.p-loading { padding: 3rem 0; }
.p-help { margin-top: 2.5rem; padding: 1rem 1.25rem; background: var(--stone); border-radius: 12px; color: var(--ink); }
.admin-banner { background: #A3462A; color: #fff; padding: .8rem 1.5rem; text-align: center; font-weight: 600; }
.muted, .p-sub { color: #2F3B36; font-size: 1rem; }

/* tabs */
.p-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0 1rem; border-bottom: 2px solid var(--line); padding-bottom: .5rem; }
.p-tabs a { padding: .6rem 1rem; border-radius: 10px; text-decoration: none; color: var(--teal); font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; }
.p-tabs a.on { background: var(--teal); color: #fff; }
.p-tabs a:hover:not(.on) { background: #e5f0f0; }
.p-tabs .spacer { flex: 1; }

/* cards & buttons */
.p-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 1.4rem 1.5rem; margin: 1rem 0; }
.p-card.warm { background: #FFF6EC; border-color: #EBCFB0; }
.p-card.good { background: #eaf5ec; border-color: #b6ddc0; }
.p-narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.p-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: .7rem 1.25rem; border-radius: 12px; border: 2px solid var(--teal); background: var(--teal); color: #fff; font: inherit; font-weight: 600; font-size: 1rem; cursor: pointer; text-decoration: none; }
.p-btn:hover { background: var(--forest-2); border-color: var(--forest-2); }
.p-btn.ghost { background: #fff; color: var(--teal); }
.p-btn.ghost:hover { background: #e5f0f0; }
.p-btn.warn { background: #A3462A; border-color: #A3462A; }
.p-btn.big { font-size: 1.1rem; padding: .9rem 1.6rem; }
.p-btn:disabled { opacity: .55; cursor: not-allowed; }
.p-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-top: .8rem; }
.p-link { background: none; border: none; color: var(--teal); text-decoration: underline; font: inherit; cursor: pointer; padding: .4rem .1rem; min-height: 40px; }
.p-chip { display: inline-block; padding: .2rem .7rem; border-radius: 999px; background: #e5f0f0; color: #143728; font-size: 1rem; font-weight: 600; }
.p-chip.amber { background: #FBE7DD; color: #7A2F18; }
.p-chip.ok { background: #d9efe0; color: #14532d; }

/* forms */
.p-form label { display: block; font-weight: 600; margin: 1rem 0 .3rem; }
.p-form .hint { display: block; font-weight: normal; color: #2F3B36; }
.p-form input[type=text], .p-form input[type=email], .p-form input[type=password], .p-form input[type=tel], .p-form input[type=number], .p-form select, .p-form textarea {
  width: 100%; padding: .7rem .8rem; border: 1.5px solid #9C9585; border-radius: 8px; font: inherit; font-size: 1rem; background: #fff; color: var(--ink);
}
.p-form textarea { min-height: 120px; line-height: 1.6; }
.p-form input:focus, .p-form textarea:focus, .p-form select:focus { outline: 3px solid #E07A5F; outline-offset: 1px; }
.p-msg { margin: .8rem 0 0; font-size: 1rem; }
.p-msg.err { color: #9B1C1C; font-weight: 600; }
.p-msg.ok { color: #14532d; font-weight: 600; }
.p-group { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.p-group:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.p-checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .3rem .9rem; }
.p-checks label { font-weight: normal; margin: .2rem 0; display: flex; gap: .5rem; align-items: flex-start; }
.p-checks input { width: 20px; height: 20px; margin-top: .25rem; flex: none; }
.p-tri { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.p-tri span { flex: 1; min-width: 200px; }
.p-tri .choice { display: flex; gap: .35rem; }
.p-tri button { min-width: 70px; min-height: 44px; border: 1.5px solid #9C9585; background: #fff; border-radius: 8px; font: inherit; cursor: pointer; }
.p-tri button.sel { border-color: var(--teal); background: var(--teal); color: #fff; font-weight: 600; }

/* stats */
.p-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin: 1rem 0; }
.p-stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; }
.p-stat b { display: block; font-family: var(--display); font-size: 2rem; color: var(--teal); line-height: 1.1; }
.p-stat.win { background: #eaf5ec; border-color: #b6ddc0; }

/* progress bar */
.p-progress { height: 14px; background: var(--line); border-radius: 7px; overflow: hidden; margin: .6rem 0; }
.p-progress span { display: block; height: 100%; background: #A3462A; }

/* journey map */
.journey { list-style: none; display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; padding: 0; margin: 1rem 0; counter-reset: j; }
.journey li { position: relative; text-align: center; padding: 0 .2rem; font-size: 1rem; line-height: 1.3; color: var(--ink); }
.journey li::before { content: ''; position: absolute; top: 20px; left: -50%; width: 100%; height: 4px; background: var(--line); z-index: 0; }
.journey li:first-child::before { display: none; }
.journey li.done::before, .journey li.now::before { background: var(--forest-2); }
.journey .dot { position: relative; z-index: 1; width: 44px; height: 44px; margin: 0 auto .4rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.1rem; background: #fff; border: 3px solid #9C9585; color: #2F3B36; }
.journey li.done .dot { background: var(--forest-2); border-color: var(--forest-2); color: #fff; }
.journey li.now .dot { background: #A3462A; border-color: #A3462A; color: #fff; box-shadow: 0 0 0 5px #F6D8CB; }
.journey li.now { font-weight: 700; }
.journey .here { display: block; color: #7A2F18; font-weight: 700; font-size: 1rem; margin-top: .2rem; }
.next-box { background: #FFF6EC; border: 2px solid #EBCFB0; border-left: 6px solid #A3462A; border-radius: 12px; padding: 1rem 1.2rem; margin: .8rem 0; }
.next-box > strong:first-child { display: block; color: #7A2F18; margin-bottom: .2rem; }
@media (max-width: 760px) {
  .journey { grid-template-columns: 1fr; }
  .journey li { display: flex; align-items: center; gap: .8rem; text-align: left; padding: .3rem 0; }
  .journey li::before { top: -50%; left: 20px; width: 4px; height: 100%; }
  .journey .dot { margin: 0; flex: none; }
  .journey .here { display: inline; margin: 0 0 0 .4rem; }
}

/* bid cards */
.bid-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.bid-head h3 { margin: 0; }

/* editor */
.qa-edit { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; margin: 1rem 0; }
.qa-edit h4 { margin: 0 0 .5rem; font-family: var(--display); font-size: 1.15rem; color: var(--teal); }
.qa-edit textarea { width: 100%; min-height: 220px; padding: .8rem; border: 1.5px solid #9C9585; border-radius: 8px; font: inherit; font-size: 1.05rem; line-height: 1.65; }
.qa-edit textarea[readonly] { background: var(--stone); }
.wc { margin-top: .4rem; font-size: 1rem; color: #2F3B36; }
.wc.over { color: #9B1C1C; font-weight: 600; }
.confirm-flag { margin-top: .4rem; background: #FBE7DD; color: #7A2F18; border-radius: 8px; padding: .5rem .75rem; font-size: 1rem; }
.p-sticky { position: sticky; bottom: env(safe-area-inset-bottom, 0px); background: rgba(250,248,245,.97); border-top: 1px solid var(--line); padding: .8rem 0; z-index: 5; }
.versions { list-style: none; padding: 0; margin: 0; }
.versions li { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; align-items: center; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.versions li.cur { font-weight: 600; }

/* ratings */
.rating { display: flex; gap: .5rem; flex-wrap: wrap; }
.rating button { min-width: 64px; min-height: 64px; font-size: 1.8rem; border: 2px solid #9C9585; background: #fff; border-radius: 14px; cursor: pointer; }
.rating button.sel { border-color: var(--teal); background: #e5f0f0; }
.rating small { display: block; font-size: 1rem; }

/* diff */
.diff { margin: .5rem 0 1rem; }
.diff dt { font-weight: 700; margin-top: .8rem; }
.diff .was { background: #FBE7DD; padding: .4rem .6rem; border-radius: 6px; margin: .2rem 0; white-space: pre-wrap; }
.diff .now { background: #d9efe0; padding: .4rem .6rem; border-radius: 6px; margin: .2rem 0; white-space: pre-wrap; }

/* toast & modal */
.p-toast { position: fixed; left: 50%; bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: #1B4332; color: #fff; padding: .9rem 1.3rem; border-radius: 12px; font-weight: 600; z-index: 50; max-width: calc(100% - 2rem); box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.p-modal { position: fixed; inset: 0; background: rgba(20,30,25,.55); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 1rem; }
.p-modal-box { background: #fff; border-radius: 18px; padding: 1.5rem; max-width: 560px; width: 100%; max-height: 90vh; overflow: auto; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; font-family: ui-monospace, Menlo, monospace; font-size: 1.1rem; background: var(--stone); padding: 1rem; border-radius: 10px; }
.qr svg { max-width: 220px; height: auto; background: #fff; }
.secret { font-family: ui-monospace, Menlo, monospace; word-break: break-all; background: var(--stone); padding: .4rem .6rem; border-radius: 6px; }
.howto svg { width: 100%; height: auto; max-width: 900px; }
details.p-details summary { cursor: pointer; font-weight: 600; color: var(--teal); min-height: 44px; display: flex; align-items: center; }
.p-logins { width: 100%; border-collapse: collapse; }
.p-logins td, .p-logins th { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); font-size: 1rem; }
.p-table-wrap { overflow-x: auto; }

/* "How it works" journey boxes */
.howto-key { display: flex; gap: 1.2rem; margin: .5rem 0; }
.howto-key .key::before { content: ""; display: inline-block; width: 1rem; height: 1rem; border-radius: 3px; margin-right: .4rem; vertical-align: -2px; border: 2px solid; }
.howto-key .you { color: #7A2F18; font-weight: 700; } .howto-key .you::before { background: #FFF6EC; border-color: #A3462A; }
.howto-key .us { color: #1B4332; font-weight: 700; } .howto-key .us::before { background: #E5F0F0; border-color: #1B4332; }
.howto-steps { list-style: none; padding: 0; margin: .6rem 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .8rem; counter-reset: none; }
.howto-steps li { border: 2px solid; border-radius: 12px; padding: .8rem .9rem; display: flex; flex-direction: column; gap: .25rem; font-size: 16px; line-height: 1.4; }
.howto-steps li.you { background: #FFF6EC; border-color: #A3462A; }
.howto-steps li.us { background: #E5F0F0; border-color: #1B4332; }
.howto-steps .n { font-weight: 700; color: #1B4332; }
.howto-steps strong { font-size: 17px; }
@media (max-width: 760px) { .howto-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .howto-steps { grid-template-columns: 1fr; } }

/* Helpful tools cards */
.p-tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.p-tools .p-card { margin: 0; display: flex; flex-direction: column; }
.p-tools .p-card h3 { margin-top: 0; }
.p-tools .p-card .p-btn { margin-top: auto; align-self: flex-start; }
@media (max-width: 860px) { .p-tools { grid-template-columns: 1fr; } }
