/* Kien San Metal — shared design tokens.
   Navy/blue follows the partner-briefing mockups the client has already seen.
   This is the client's product, so it deliberately does not use NineTen's pink. */

:root {
  /* brand */
  --navy: #1e3a5f;
  --navy-deep: #16294353;
  --navy-ink: #142a45;
  --blue: #2f6fb3;
  --blue-strong: #245a94;
  --blue-tint: #eaf2fb;

  /* surfaces */
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e8ee;
  --line-strong: #cfd7e0;

  /* text */
  --text: #16202c;
  --muted: #5b6672;
  --faint: #8b95a1;

  /* movement — up is green (we pay more), down is red. Never colour alone. */
  --up: #1b7f3b;
  --up-bg: #e8f5ec;
  --down: #c62828;
  --down-bg: #fdecec;
  --same: #6b7684;
  --same-bg: #f0f2f5;
  --new: #a35a00;
  --new-bg: #fff4e2;

  /* status */
  --ok: #1b7f3b;
  --warn: #a35a00;
  --danger: #c62828;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 1px 2px rgba(20, 42, 69, .06), 0 4px 14px rgba(20, 42, 69, .05);
  --shadow-pop: 0 8px 30px rgba(20, 42, 69, .18);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* Tabular figures matter: prices must align column-wise and not jitter as they change. */
  --font-num: ui-monospace, "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
}

/* Chinese needs its own faces and a little more leading — the default Latin
   stack renders CJK via fallback, which is inconsistent across phones and thin
   at the sizes older readers use. Keyed on :lang, which the shell sets before
   first paint. */
:root:lang(zh) {
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Noto Sans CJK SC", "Source Han Sans SC", "Microsoft YaHei", sans-serif;
}
:lang(zh) body { line-height: 1.7; }

* { box-sizing: border-box; }

/* ------------------------------------------------------------------------
   The client's mark on a dark bar.

   KS's logo is drawn for a light ground: the letters are #4D5AA3 and the
   wordmark #232021. Measured against our navy (#1e3a5f) the letters come out at
   1.8:1 — effectively invisible, and the wordmark worse. Recolouring it would
   destroy the brand, so it gets a white chip instead. That is also how the
   client uses it on their own site.

   The mark is 1.46:1, not square — height is fixed and width follows, or the
   mountain squashes.
   ------------------------------------------------------------------------ */
.logo-chip {
  background: #fff;
  border-radius: .4em;
  padding: .25em .3em;
  display: block;
  width: auto;
  flex: none;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* ------------------------------------------------------------------------
   Shared components — everything ui.js can render.
   These MUST live here, not in admin.css: ui.js is used by both roles, and a
   component whose styles ship with only one of them renders unstyled in the
   other. (The modal did exactly that: it appeared 4000px down the branch page
   with no backdrop.)
   Sized in rem so they scale with the member's font-size control for free.
   ------------------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  border: 1px solid var(--line-strong); background: #fff; color: var(--text);
  padding: .45rem .85rem; border-radius: .5rem; font-size: .85rem; font-weight: 600;
  cursor: pointer; font-family: inherit; min-height: 2.25rem;
}
.btn:hover:not(:disabled) { border-color: var(--navy); }
.btn:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--blue-strong); border-color: var(--blue-strong); }
.btn.danger { color: var(--danger); border-color: #f0c6c6; }
.btn.danger:hover:not(:disabled) { background: var(--down-bg); border-color: var(--danger); }
.btn.sm { padding: .25rem .55rem; font-size: .78rem; min-height: 0; }

.badge { display: inline-block; padding: .16rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 700; letter-spacing: .02em; }
.badge.draft { background: var(--new-bg); color: var(--new); }
.badge.published { background: var(--up-bg); color: var(--up); }
.badge.none { background: var(--same-bg); color: var(--same); }
.badge.info { background: var(--blue-tint); color: var(--blue-strong); }

.notice {
  display: block; padding: .75rem .9rem; border-radius: var(--radius);
  font-size: .82rem; line-height: 1.55; margin-bottom: 1rem; border: 1px solid;
}
.notice b { display: block; margin-bottom: .15rem; }
.notice.warn { background: var(--new-bg); border-color: #f0d9ae; color: #6d3d00; }
.notice.info { background: var(--blue-tint); border-color: #c8ddf3; color: #1c4470; }
.notice.ok { background: var(--up-bg); border-color: #bfe2ca; color: #14522a; }
.notice.err { background: var(--down-bg); border-color: #f0c6c6; color: #8c1f1f; }

.field { display: block; margin-bottom: .8rem; }
.field > span { display: block; font-size: .78rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line-strong);
  border-radius: .5rem; font: inherit; font-size: .875rem; background: #fff; color: var(--text);
}
.field textarea { font-family: var(--font-num); font-size: .8rem; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
.field .hint { font-size: .74rem; color: var(--faint); font-weight: 400; margin-top: .2rem; display: block; }

.modal-bg { position: fixed; inset: 0; background: rgba(20, 42, 69, .5); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 50; }
.modal { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); width: 100%; max-width: 32rem; max-height: 88vh; overflow: auto; }
.modal.wide { max-width: 48rem; }
.modal-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.modal-head h3 { margin: 0; font-size: 1rem; }
.modal-body { padding: 1.25rem; }
.modal-foot { padding: .9rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .5rem; }
.x { background: none; border: none; font-size: 1.3rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 .4rem; font-family: inherit; min-height: 2.25rem; }

.toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); background: var(--navy-ink); color: #fff; padding: .65rem 1.1rem; border-radius: 999px; box-shadow: var(--shadow-pop); font-size: .85rem; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--danger); }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty b { display: block; font-size: 1rem; color: var(--text); margin-bottom: .3rem; }

.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- role picker (landing) ---------- */

/* Two soft glows lift the flat navy off the page. Kept low-contrast so the
   white cards stay the focus and nothing competes with the logo. */
.pick-body {
  background:
    radial-gradient(1100px 520px at 50% -12%, rgba(125, 179, 232, .18), transparent 60%),
    radial-gradient(820px 460px at 106% 116%, rgba(47, 111, 179, .16), transparent 55%),
    var(--navy);
}

.pick {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3.5rem 1.25rem 2.5rem;
  color: #fff;
}

.pick-head { display: flex; align-items: center; gap: 1.1rem; margin-bottom: 2.25rem; flex-wrap: wrap; }
.pick-title { margin-right: auto; }
.pick-head h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.02em; }
.pick-head p { margin: .2rem 0 0; color: #a9c2dd; font-size: .92rem; }
/* 108px keeps the "KS GROUP OF COMPANIES" line above ~12px, where it stops
   being legible. The lockup PNG is transparent, so the white backing is here;
   the radius + shadow float it off the navy. */
.pick-logo {
  height: 108px; width: auto; display: block; flex: none;
  background: #fff; padding: .4rem .6rem;
  border-radius: 14px; box-shadow: 0 6px 22px rgba(9, 20, 35, .35);
}
@media (max-width: 520px) { .pick-logo { height: 88px; } }

/* A quiet "this is the real thing", in place of the old prototype label. */
.pick-live {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .32rem .72rem; border-radius: 999px;
  background: rgba(46, 160, 90, .16); border: 1px solid rgba(46, 160, 90, .42);
  color: #bdedcd; font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
}
.pick-live-dot { width: .5rem; height: .5rem; border-radius: 50%; background: #34d17f; animation: pick-pulse 2.4s ease-out infinite; }
@keyframes pick-pulse {
  0% { box-shadow: 0 0 0 0 rgba(52, 209, 127, .55); }
  70% { box-shadow: 0 0 0 .5rem rgba(52, 209, 127, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 209, 127, 0); }
}
@media (prefers-reduced-motion: reduce) { .pick-live-dot { animation: none; } }

.pick-lede { color: #cfe0f0; margin: 0 0 1.1rem; font-size: 1.02rem; font-weight: 500; }

.pick-grid { display: grid; gap: 1.1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 620px) { .pick-grid { grid-template-columns: 1fr; } }

.pick-card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: .55rem;
  background: #fff; color: var(--text);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.4rem 1.35rem;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  border: 1px solid transparent;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
/* A thin brand bar along the top edge, brightening on hover. */
.pick-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--blue), #7db3e8);
  opacity: .5; transition: opacity .14s ease;
}
.pick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); border-color: var(--blue); }
.pick-card:hover::before { opacity: 1; }
.pick-card:focus-visible { outline: 3px solid #7db3e8; outline-offset: 3px; }

.pick-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.9rem; height: 2.9rem; border-radius: 12px;
  background: var(--blue-tint); font-size: 1.5rem; line-height: 1; margin-bottom: .1rem;
}
.pick-card strong { font-size: 1.18rem; letter-spacing: -.01em; }
.pick-desc { color: var(--muted); font-size: .9rem; line-height: 1.55; }
.pick-go { color: var(--blue); font-weight: 700; font-size: .9rem; margin-top: .35rem; display: inline-flex; align-items: center; gap: .35rem; }
.pick-arrow { transition: transform .14s ease; }
.pick-card:hover .pick-arrow { transform: translateX(3px); }

.pick-note {
  margin: 2.25rem 0 0; padding: 1rem 1.15rem;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .1);
  border-left: 3px solid #7db3e8;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #d3e3f2; font-size: .85rem; line-height: 1.65;
}
.pick-note strong { color: #fff; }
.pick-foot { margin: 1.5rem 0 0; color: #7f9bb8; font-size: .78rem; }
