:root {
  --bg: #f6fbfe;
  --surface: #fff;
  --soft: #eaf6fb;
  --pink-soft: #fff2f7;
  --title: #274c77;
  --title-dark: #183b63;
  --text: #243746;
  --muted: #6c7f8e;
  --line: #d9e9f1;
  --accent: #5fa8d3;
  --accent-dark: #397fa9;
  --green: #2d8868;
  --amber: #a66b16;
  --red: #ad505a;
  --shadow: 0 8px 28px rgba(39, 76, 119, .08);
  --radius: 14px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Microsoft JhengHei", "Noto Sans TC", system-ui, sans-serif; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 3px solid rgba(95, 168, 211, .35); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.release-header { min-height: 72px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 28px; padding: 0 28px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.release-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--title); }
.release-brand-mark { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 850; background: linear-gradient(135deg, var(--accent), #87cadf 58%, #e99fbb); box-shadow: 0 5px 13px rgba(95,168,211,.24); }
.release-brand strong, .release-brand small { display: block; }
.release-brand strong { font-size: 17px; }
.release-brand small { color: var(--muted); font-size: 11px; }
.release-nav { display: flex; align-items: center; gap: 5px; }
.release-nav a { text-decoration: none; color: #566f7f; font-size: 14px; font-weight: 700; padding: 9px 12px; border-radius: 9px; }
.release-nav a:hover { background: var(--soft); color: var(--title); }
.release-nav a.is-active { background: var(--soft); color: var(--title); }
.release-header-actions { display: flex; align-items: center; gap: 10px; }
.release-mode-badge { border: 1px solid #d0e5ef; background: #f5fbfe; color: var(--title); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 750; }
.release-mode-badge.view { border-color: #f0d6e0; background: var(--pink-soft); color: #92536b; }

.btn { min-height: 40px; border-radius: 10px; padding: 0 15px; border: 1px solid transparent; font-weight: 750; }
.btn-primary { background: var(--accent-dark); color: #fff; box-shadow: 0 5px 14px rgba(57,127,169,.18); }
.btn-primary:hover { background: #2d6f99; }
.btn-primary:disabled { opacity: .55; cursor: wait; }
.btn-secondary { background: #fff; color: var(--title); border-color: var(--line); }
.btn-secondary:hover { background: var(--soft); border-color: #afd3e3; }

.release-main { width: min(1500px, 100%); margin: 0 auto; padding: 26px 30px 44px; }
.release-title-row { min-height: 104px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.release-title-row h1 { margin: 2px 0 5px; color: var(--title-dark); font-size: clamp(27px, 3vw, 36px); line-height: 1.25; letter-spacing: -.02em; }
.release-title-row p:last-child { margin: 0; color: var(--muted); font-size: 14px; }
.release-eyebrow { margin: 0; color: var(--accent-dark); font-size: 11px; line-height: 1.4; font-weight: 850; letter-spacing: .13em; }
.release-mascot { width: 92px; height: 92px; object-fit: contain; margin-right: 20px; }
.release-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.release-metrics article { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; box-shadow: 0 4px 16px rgba(39,76,119,.04); }
.release-metrics span { display: block; color: var(--muted); font-size: 13px; }
.release-metrics strong { display: block; margin-top: 4px; color: var(--title); font-size: 26px; }

.release-toolbar { display: grid; grid-template-columns: minmax(250px, 1.4fr) minmax(170px, .55fr) minmax(150px, .45fr) auto; gap: 9px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 15px; }
.release-toolbar input, .release-toolbar select { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; color: var(--text); padding: 0 11px; }
.search-box { position: relative; }
.search-box span { position: absolute; left: 12px; top: 8px; color: var(--muted); font-size: 18px; }
.search-box input { padding-left: 38px; }
.release-status { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 18px; color: var(--muted); text-align: center; }
.release-status.is-error { color: var(--red); border-color: #efcdd1; background: #fff8f8; }

.release-workspace { display: grid; grid-template-columns: minmax(305px, 355px) minmax(0, 1fr); gap: 15px; align-items: start; }
.release-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; padding: 15px 16px; border-bottom: 1px solid var(--line); }
.panel-heading h2 { margin: 0; color: var(--title); font-size: 16px; }
.panel-heading span { color: var(--muted); background: var(--soft); border-radius: 999px; padding: 3px 8px; font-size: 12px; }
.release-list { padding: 7px; display: grid; gap: 4px; max-height: calc(100vh - 335px); overflow: auto; }
.release-list-item { border: 1px solid transparent; background: transparent; color: inherit; border-radius: 10px; padding: 12px; text-align: left; width: 100%; }
.release-list-item:hover { border-color: var(--line); background: #f9fcfe; }
.release-list-item.is-active { border-color: #bcddec; background: var(--soft); }
.release-item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.release-item-version { color: var(--title); font-size: 16px; font-weight: 850; }
.release-item-title { margin-top: 5px; font-size: 14px; font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.release-item-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 7px; color: var(--muted); font-size: 12px; }
.release-item-meta i { width: 3px; height: 3px; border-radius: 50%; background: #a6b6bf; }
.status-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-released { color: var(--green); background: #e8f7f1; }
.status-preparing { color: var(--amber); background: #fff5df; }
.status-draft { color: #667b89; background: #edf3f6; }
.status-hotfix { color: var(--red); background: #fff0f2; }
.release-empty { padding: 34px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.release-empty strong, .release-empty span { display: block; }
.release-empty strong { color: var(--title); font-size: 16px; margin-bottom: 4px; }

.detail-head { padding: 20px 22px 18px; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #f6fcff 0%, #fff 58%, #fff5f8 100%); }
.detail-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; }
.detail-project { margin: 0; color: var(--accent-dark); font-size: 12px; font-weight: 850; letter-spacing: .06em; }
.detail-head h2 { margin: 3px 0 5px; color: var(--title-dark); font-size: 24px; line-height: 1.35; }
.detail-updated { color: var(--muted); font-size: 12px; }
.detail-facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 16px; }
.detail-fact { min-width: 0; background: rgba(255,255,255,.82); border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; }
.detail-fact span { display: block; color: var(--muted); font-size: 11px; }
.detail-fact strong { display: block; margin-top: 2px; color: var(--title); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.detail-pitfall-link { color: var(--accent-dark); text-decoration: none; }
.detail-pitfall-link:hover { text-decoration: underline; }
.detail-body { padding: 18px 21px 22px; display: grid; gap: 12px; }
.detail-section { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.detail-section summary { list-style: none; cursor: pointer; padding: 13px 14px; color: var(--title); font-weight: 800; display: flex; align-items: center; gap: 9px; }
.detail-section summary::-webkit-details-marker { display: none; }
.detail-section summary::after { content: "⌄"; margin-left: auto; color: var(--muted); transition: transform .2s; }
.detail-section:not([open]) summary::after { transform: rotate(-90deg); }
.detail-icon { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: var(--soft); color: var(--accent-dark); }
.detail-count { color: var(--muted); font-size: 12px; font-weight: 600; }
.detail-content { border-top: 1px solid var(--line); padding: 14px; color: var(--text); font-size: 14px; }
.detail-content pre { margin: 0; font: inherit; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-placeholder { color: #8a9aa5; font-style: italic; }
.detail-diff .detail-content { max-height: 310px; overflow: auto; background: #fbfdff; }
.detail-diff pre { font-family: Consolas, ui-monospace, monospace; font-size: 13px; }

.release-modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(28,52,73,.48); backdrop-filter: blur(3px); }
.release-modal { width: min(760px, 100%); max-height: calc(100vh - 36px); overflow: auto; background: #fff; border-radius: 16px; box-shadow: 0 24px 80px rgba(25,55,79,.26); }
.modal-heading { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.modal-heading h2 { margin: 2px 0 0; color: var(--title); font-size: 20px; }
.modal-close { width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 22px; }
.modal-close:hover { background: var(--soft); }
.modal-body { padding: 19px 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { display: grid; gap: 6px; color: var(--title); font-size: 13px; font-weight: 750; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; color: var(--text); padding: 9px 10px; }
.form-grid textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.form-details { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.form-details summary { list-style: none; cursor: pointer; color: var(--title); font-size: 13px; font-weight: 800; padding: 11px 12px; background: #f8fcfe; }
.form-details summary::-webkit-details-marker { display: none; }
.form-details summary::before { content: "＋"; display: inline-block; width: 22px; color: var(--accent-dark); }
.form-details[open] summary::before { content: "－"; }
.form-details summary span { color: var(--muted); font-weight: 500; margin-left: 6px; }
.form-details > label { margin: 12px; }
.form-details small { text-align: right; color: var(--muted); font-weight: 500; }
.draft-hint { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 13px; padding: 8px 10px; border: 1px solid #f0dcb4; border-radius: 8px; background: #fff9ec; color: var(--amber); font-size: 13px; font-weight: 700; }
.draft-clear { border: 0; background: none; padding: 2px 4px; color: var(--accent-dark); font-size: 13px; font-weight: 700; text-decoration: underline; }
.form-grid label small { color: var(--muted); font-weight: 500; }
.form-error { margin: 12px 0 0; color: var(--red); background: #fff4f5; border: 1px solid #f0d3d6; padding: 8px 10px; border-radius: 8px; font-size: 13px; }
.modal-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; background: #fbfdff; border-top: 1px solid var(--line); }
.release-toast { position: fixed; right: 22px; bottom: 22px; z-index: 70; color: #fff; background: var(--title-dark); border-radius: 10px; padding: 11px 15px; box-shadow: 0 10px 30px rgba(24,59,99,.24); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; }
.release-toast.show { transform: translateY(0); opacity: 1; }

.release-login-page { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 20% 15%, #e7f6fc 0, transparent 34%), radial-gradient(circle at 80% 82%, #fdeaf2 0, transparent 28%), var(--bg); }
.release-login-card { position: relative; width: min(450px, 100%); padding: 42px 40px 34px; background: rgba(255,255,255,.96); border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 20px 70px rgba(39,76,119,.13); }
.release-login-card h1 { margin: 5px 0 7px; color: var(--title-dark); font-size: 27px; }
.release-login-note { margin: 0 0 21px; color: var(--muted); font-size: 14px; }
.release-login-mascots { position: absolute; right: 20px; top: -43px; display: flex; align-items: flex-end; }
.release-login-mascots img { width: 62px; height: 62px; object-fit: contain; }
.release-login-mascots img + img { margin-left: -13px; width: 55px; height: 55px; }
.release-login-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; background: #edf6fa; border-radius: 10px; margin-bottom: 18px; }
.release-login-switch button { min-height: 38px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-weight: 750; }
.release-login-switch button.is-active { background: #fff; color: var(--title); box-shadow: 0 3px 10px rgba(39,76,119,.08); }
.release-login-card form label { display: block; color: var(--title); font-size: 13px; font-weight: 750; margin-bottom: 6px; }
.release-login-card form input { width: 100%; min-height: 45px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfdff; }
.release-login-submit { width: 100%; margin-top: 14px; }
.release-login-back { display: block; margin-top: 18px; text-align: center; color: var(--accent-dark); font-size: 13px; text-decoration: none; }

@media (max-width: 1000px) {
  .release-header { grid-template-columns: auto 1fr; }
  .release-nav { order: 3; grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 5px 0; }
  .release-main { padding-top: 20px; }
  .release-detail .detail-facts { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .release-header { padding: 12px 15px 0; gap: 12px; }
  .release-brand small { display: none; }
  .release-header-actions .release-mode-badge { display: none; }
  .release-nav { overflow-x: auto; }
  .release-nav a { white-space: nowrap; }
  .release-main { padding: 18px 14px 34px; }
  .release-mascot { width: 70px; height: 70px; margin: 0; }
  .release-metrics { grid-template-columns: repeat(2, 1fr); }
  .release-toolbar { grid-template-columns: 1fr 1fr; }
  .release-toolbar .search-box { grid-column: 1 / -1; }
  .release-workspace { grid-template-columns: 1fr; }
  .release-list { max-height: 340px; }
}
@media (max-width: 520px) {
  .release-brand strong { font-size: 14px; }
  .release-brand-mark { width: 34px; height: 34px; }
  .release-header-actions .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .release-title-row { min-height: 0; }
  .release-title-row p:last-child { font-size: 13px; }
  .release-mascot { display: none; }
  .release-toolbar { grid-template-columns: 1fr; }
  .release-toolbar .search-box { grid-column: auto; }
  .detail-top { display: block; }
  .detail-top .btn { margin-top: 12px; }
  .detail-facts { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .release-login-card { padding: 38px 24px 28px; }
}
