/* ── alert-sheet.css: 급등 알림 설정 시트 (alert-sheet.js) ──
   폰에서는 아래에서 올라오는 시트, 넓은 화면에서는 가운데 창이다.
   토큰은 base.css 그대로. 입력칸 글자는 16px 이상 — iOS 는 그보다 작으면 포커스 때 화면을 확대한다. */

html.as-open { overflow: hidden; }
.as-backdrop { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; background: rgba(4, 7, 14, .66); }
.as-backdrop[hidden], .as-backdrop [hidden] { display: none !important; }
.as-sheet {
  width: 100%; max-width: 440px; height: min(92dvh, 840px);
  display: flex; flex-direction: column; overflow: hidden; outline: none;
  background: var(--bg-card); border: 1px solid var(--border); border-bottom: 0; border-radius: 18px 18px 0 0;
  color: var(--text-body); font-size: 14px; line-height: 1.45;
}
@media (min-width: 600px) {
  .as-backdrop { align-items: center; }
  .as-sheet { height: min(88vh, 840px); border-bottom: 1px solid var(--border); border-radius: 18px; }
}
.as-sheet :focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.as-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.as-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px calc(20px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
.as-sheet button { font: inherit; cursor: pointer; }
.as-sheet button:disabled { cursor: not-allowed; }

/* 목록 머리 */
.as-grab { width: 40px; height: 4px; margin: 8px auto 2px; border-radius: 2px; background: #2a3550; }
.as-head { display: flex; align-items: center; gap: 4px; padding: 6px 8px 8px 16px; }
.as-head-text { flex: 1; min-width: 0; }
.as-head h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--text-primary); }
.as-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.as-x { width: 44px; height: 44px; border: 0; background: none; color: var(--text-muted); font-size: 16px; }
.as-notice { display: grid; gap: 12px; padding: 14px; margin: 4px 0 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input); }
.as-notice p { margin: 0; color: var(--text-body); }
.as-sec { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 11px; letter-spacing: .06em; color: var(--text-dim); text-transform: uppercase; }
.as-msg { min-height: 1.4em; margin: 8px 0 0; font-size: 12.5px; color: var(--green); }
.as-msg.bad { color: var(--red); }

/* 조건 목록 */
.as-rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.as-rules.muted { opacity: .45; }
.as-rule { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px; padding: 12px 6px 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input); }
.as-rule.is-off .as-rule-main { opacity: .45; }
.as-rule-main { display: grid; gap: 4px; min-width: 0; padding: 0; border: 0; background: none; color: inherit; text-align: left; }
.as-rule-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.as-ex { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-body); }
.as-ex::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.as-tag { padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; font-size: 10.5px; color: var(--text-muted); }
.as-rule-text { font-size: 15px; color: var(--text-primary); overflow-wrap: anywhere; }
.as-rule-text b { color: var(--yellow); }
.as-rule-meta { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.as-evid { font-size: 11.5px; }
.as-evid.ok { color: var(--green); }
.as-evid.wip { color: var(--yellow); }

.as-switch { position: relative; flex: none; width: 50px; height: 44px; padding: 0; border: 0; background: none; }
.as-switch::before { content: ""; position: absolute; left: 2px; top: 8px; width: 46px; height: 28px; border-radius: 14px; background: #26314d; transition: background .15s; }
.as-switch::after { content: ""; position: absolute; left: 5px; top: 11px; width: 22px; height: 22px; border-radius: 50%; background: var(--text-body); transition: transform .15s; }
.as-switch[aria-checked="true"]::before { background: var(--indigo); }
.as-switch[aria-checked="true"]::after { transform: translateX(18px); background: #fff; }
.as-switch:disabled { opacity: .3; }

.as-add { width: 100%; min-height: 44px; margin-top: 8px; border: 1px dashed #2f3d60; border-radius: 12px; background: none; color: var(--indigo); font-size: 14px; }
.as-hist { list-style: none; margin: 0; padding: 0; }
.as-hist li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--border-dim); }
.as-h-title { font-size: 14px; color: var(--text-primary); text-decoration: none; overflow-wrap: anywhere; }
.as-h-rule { font-size: 12px; color: var(--text-muted); }
.as-h-time { grid-column: 2; grid-row: 1 / span 2; align-self: center; font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.as-empty { display: block !important; font-size: 13px; color: var(--text-dim); }
.as-ghost { width: 100%; min-height: 44px; margin-top: 12px; border: 1px solid var(--border); border-radius: 12px; background: none; color: var(--text-body); font-size: 14px; }
.as-primary { min-height: 44px; padding: 0 22px; border: 0; border-radius: 10px; background: var(--indigo); color: #fff; font-size: 15px; font-weight: 700; }
.as-primary:disabled { background: #2a3550; color: var(--text-dim); }
.as-notice .as-primary { justify-self: start; }

/* 편집 머리 */
.as-bar { display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 6px; border-bottom: 1px solid var(--border); }
.as-back { width: 44px; height: 44px; border: 0; background: none; color: var(--text-muted); font-size: 18px; }
.as-bar-title { flex: 1; margin: 0; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.as-del { min-height: 44px; padding: 0 8px; border: 0; background: none; color: var(--red); font-size: 14px; }

/* 편집 칸 */
.as-editor { display: grid; gap: 22px; padding-top: 16px; align-content: start; }
.as-field { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.as-field legend { padding: 0; margin-bottom: 8px; font-size: 12px; letter-spacing: .04em; color: var(--text-muted); }
.as-field legend span { color: var(--text-dim); }
.as-hint { margin: 0; font-size: 12px; line-height: 1.45; color: var(--text-muted); }
.as-err { margin: 0; font-size: 12px; color: var(--red); }
.as-err:empty { display: none; }
.as-warn { margin: 0; font-size: 13px; color: var(--yellow); }

/* 칸 수는 버튼 수를 따라간다 — 3칸으로 박아 두면 버튼이 둘인 묶음(무엇이 움직였을 때)이
   2/3 만 채우고 오른쪽 한 칸이 빈 채로 남는다 */
.as-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.as-seg button { min-height: 44px; padding: 0 4px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 0; border-left: 1px solid var(--border); background: var(--bg-input); color: var(--text-muted); font-size: 13px; }
.as-seg button:first-child { border-left: 0; }
.as-seg button[aria-pressed="true"] { background: rgba(102, 126, 234, .15); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--indigo); }
.as-seg i { flex: none; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }

.as-num { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.as-box { display: flex; align-items: baseline; gap: 6px; min-height: 56px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-input); cursor: text; }
.as-box:focus-within { border-color: var(--indigo); }
.as-box[data-invalid="true"] { border-color: var(--red); }
.as-box input { width: 100%; min-width: 0; padding: 0; border: 0; background: none; color: var(--text-primary); font: 700 28px/56px var(--font-mono); font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.as-box input:focus { outline: none; }
.as-affix { font-size: 16px; color: var(--text-muted); white-space: nowrap; }
.as-box.pct { justify-content: center; }
.as-box.pct input { flex: none; width: 5ch; text-align: center; }
.as-box.pct input, .as-box.pct .as-affix { color: var(--yellow); }
.as-sheet input[type="number"]::-webkit-inner-spin-button, .as-sheet input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.as-unit, .as-steppers { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.as-unit button, .as-steppers button { min-width: 50px; border: 0; border-left: 1px solid var(--border); background: var(--bg-input); color: var(--text-muted); font-size: 13px; }
.as-steppers button { color: var(--text-primary); font-size: 20px; }
.as-unit button:first-child, .as-steppers button:first-child { border-left: 0; }
.as-unit button[aria-pressed="true"] { background: rgba(102, 126, 234, .15); color: var(--text-primary); }

.as-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.as-quick-label { margin-right: 2px; font-size: 11px; color: var(--text-dim); }
.as-quick button { min-height: 36px; padding: 0 11px; border: 1px solid var(--border); border-radius: 18px; background: none; color: var(--text-muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.as-quick button[aria-pressed="true"] { border-color: var(--indigo); background: rgba(102, 126, 234, .15); color: var(--text-primary); }

.as-opt { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.as-opt b { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.as-opt-body { display: grid; gap: 8px; padding: 2px 0 10px; }
.as-inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.as-inline input { width: 80px; min-height: 44px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input); color: var(--text-primary); font: 16px var(--font-mono); text-align: center; -moz-appearance: textfield; }
.as-inline input[aria-invalid="true"] { border-color: var(--red); }

.as-pick { display: grid; gap: 8px; }
.as-coin-add { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 0; }
.as-coin-add input { min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-input); color: var(--text-primary); font: 16px var(--font-mono); text-transform: uppercase; }
.as-coin-add input::placeholder { text-transform: none; color: var(--text-dim); }
.as-coin-add button { min-height: 44px; padding: 0 16px; border: 1px solid var(--indigo); border-radius: 10px; background: rgba(102, 126, 234, .15); color: var(--text-primary); font-size: 14px; }
.as-coins { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.as-coins li { display: inline-flex; align-items: center; gap: 2px; padding-left: 10px; border: 1px solid var(--border); border-radius: 16px; color: var(--text-primary); font-size: 13px; }
.as-coins button { width: 34px; height: 34px; border: 0; background: none; color: var(--text-muted); font-size: 16px; }

.as-evidence { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: linear-gradient(180deg, rgba(102, 126, 234, .07), transparent 60%), var(--bg-input); }
.as-evidence p { margin: 0; font-size: 13px; }
.as-ev-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.as-ev-head strong { font-size: 13px; color: var(--text-primary); }
.as-pill { padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; color: var(--bg-page); }
.as-pill.ok { background: var(--green); }
.as-pill.wip { background: var(--yellow); }
.as-ev-src { font-size: 11.5px !important; color: var(--text-muted); }
.as-ev-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.as-ev-stats dt { margin-bottom: 2px; font-size: 11px; color: var(--text-dim); }
.as-ev-stats dd { margin: 0; font-size: 14px; color: var(--text-primary); }
.as-ev-stats dd.good { color: var(--green); }
.as-risk { color: var(--red); }
.as-ev-foot { padding-top: 10px; border-top: 1px solid var(--border-dim); font-size: 12px !important; color: var(--text-dim); }

.as-save { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg-card); }
.as-save p { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.as-save small { display: block; min-height: 1.3em; font-size: 12px; color: var(--green); }
.as-save small.bad { color: var(--red); }

@media (prefers-reduced-motion: reduce) { .as-switch::before, .as-switch::after { transition: none; } }
