/* Step 2 bundle A: common base on top of styles.css (tokens reused, nothing renamed).
   Agreed in mockups R3. Screen-specific layouts (services, benefits, projects, wallet) come with bundle B. */

/* Buttons: secondary (.btn), primary (.btn.primary, black), danger (.btn.danger, red text), link, waiting. */
.btn.danger{color:var(--red);background:#fff;border-color:var(--line)}
.btn.danger:hover{background:#fff5f4;border-color:#f3c7c2}
.btn.link{border:0;background:transparent;padding:0;min-height:auto;min-width:0;color:var(--text);text-decoration:underline;text-underline-offset:3px;font-weight:650;box-shadow:none}
.btn.waiting{background:#f1f2f4;color:#8a919c;border-color:#e6e8ec;cursor:default}

/* Card head: title left, one action right. */
.ui-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin:0 0 14px}
.ui-head h2{font-size:17px;line-height:1.3;margin:0 0 3px;font-weight:760;letter-spacing:-.02em}
.ui-head p{margin:0;font-size:13px;color:var(--muted);line-height:1.5}
.ui-head .btn{flex:none}

/* Rows instead of cards inside cards. */
.ui-rows{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.ui-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 0;border-top:1px solid var(--line)}
.ui-row:first-child{border-top:0;padding-top:4px}
.ui-row:last-child{padding-bottom:2px}
.ui-row .main{min-width:0;display:flex;flex-direction:column;gap:4px}
.ui-row .main strong{font-size:15px;line-height:1.35}
.ui-row .sub{font-size:13px;color:var(--muted);line-height:1.5}
.ui-row .side{display:flex;align-items:center;gap:8px;flex:none}

/* Status chips: neutral (default), waiting (.pending), good (.on), bad. */
.status-chip.bad{background:#fdecea;color:#a1271b}

/* Loading, empty and failed states for every card and list. */
.ui-state{display:flex;flex-direction:column;align-items:flex-start;gap:8px;padding:16px;border-radius:14px;background:#f6f7f9;color:#4b5563}
.ui-state strong{color:var(--text);font-size:14px;line-height:1.45}
.ui-state span{font-size:13px;line-height:1.5;color:var(--muted)}
.ui-state.center{align-items:center;text-align:center}
.ui-state.error{background:#fff7f5}
.ui-state.error strong{color:#8f2a1f}
.ui-state .btn{margin-top:4px}
.ui-state-loading{gap:0;padding:14px 16px}
.ui-skeleton{height:12px;border-radius:6px;background:linear-gradient(90deg,#eef0f3,#f6f7f9,#eef0f3);background-size:200% 100%;margin:6px 0;animation:ui-shimmer 1.4s ease-in-out infinite}
.ui-skeleton.w80{width:80%}.ui-skeleton.w60{width:60%}.ui-skeleton.w40{width:40%}
@keyframes ui-shimmer{0%{background-position:100% 0}100%{background-position:-100% 0}}
@media (prefers-reduced-motion:reduce){.ui-skeleton{animation:none}}
.ui-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}

/* Field error under the field. */
.field.has-error .input,.field.has-error input,.field.has-error select,.field.has-error textarea{border-color:#e0786c;box-shadow:0 0 0 3px rgba(224,120,108,.14)}
.field-error{font-size:12px;color:var(--red);font-weight:600;line-height:1.45}
.field-help{font-size:12px;color:var(--muted);line-height:1.45}

/* In-page dialog (same frame as the refund dialog). */
dialog.ui-dialog{width:min(480px,calc(100% - 28px));max-height:calc(100% - 40px);overflow:auto;border:0;border-radius:22px;padding:24px;background:#fff;color:var(--text);box-shadow:0 30px 80px rgba(15,23,42,.25)}
dialog.ui-dialog::backdrop{background:rgba(20,25,34,.4);backdrop-filter:blur(3px)}
.ui-dialog h2{margin:2px 0 8px;font-size:19px;line-height:1.35;letter-spacing:-.02em}
.ui-dialog .lead{margin:0 0 8px;color:#4b5563;font-size:14px;line-height:1.6}
.ui-dialog .actions-row{display:flex;justify-content:flex-end;gap:8px;margin-top:20px;flex-wrap:wrap}
.ui-dialog .actions-row .btn{min-width:88px}
@media (max-width:480px){.ui-dialog .actions-row .btn{flex:1}}

/* Sub tabs inside a view. */
.ui-subtabs{display:flex;gap:4px;padding:4px;border:1px solid var(--line);border-radius:13px;background:#f6f7f9;width:max-content;max-width:100%;overflow-x:auto;margin:0 0 16px}
.ui-subtabs button{appearance:none;border:0;background:transparent;min-height:36px;padding:7px 14px;border-radius:10px;font:inherit;font-weight:700;color:#67707c;white-space:nowrap;cursor:pointer}
.ui-subtabs button.on{background:#fff;color:var(--text);box-shadow:0 1px 3px rgba(15,23,42,.09)}

/* Cards side by side start at the same height (fixes a 14px offset on the right card). */
.app-shell .grid>.card{margin-top:0}

/* Step 2 B1: 내 정보 tab. */
.me-card+.me-card{margin-top:16px}
.me-amount{font-weight:760;font-variant-numeric:tabular-nums}
.me-actions{display:flex;flex-wrap:wrap;gap:8px;margin-top:16px}
.hist-type{display:inline-block;min-width:44px;margin-right:6px;font-size:12px;font-weight:700;color:var(--muted)}
.ui-state-item{list-style:none}
@media(max-width:760px){.app-shell .app-nav{justify-content:space-between}.app-shell .app-nav-item{padding:8px 9px;font-size:15px}}
@media(max-width:360px){.app-shell .app-nav-item{padding:8px 6px;font-size:14px}}

/* Dialogs scroll inside the rounded card, never on the transparent dialog frame (the scrollbar used to stick out beside the card). */
dialog.payment-dialog,dialog.service-detail-dialog,dialog.storage-detail-dialog{overflow:visible;max-height:calc(100dvh - 28px)}
dialog.payment-dialog>.service-dialog-card,dialog.service-detail-dialog>.service-detail-panel,dialog.storage-detail-dialog>.storage-detail-panel{box-sizing:border-box;max-height:calc(100dvh - 28px);overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--wfix-scroll-thumb,#aeb9c5) transparent}

/* Step 2 B1 R2: meal widget. */
.meal-widget{display:flex;flex-direction:column;gap:10px;min-width:0}
.meal-head,.meal-venue-head{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap}
.day-switch{display:flex;gap:4px;flex-wrap:wrap}
.day-switch button{appearance:none;border:1px solid var(--line);background:#fff;border-radius:9px;min-height:30px;padding:3px 10px;font:inherit;font-size:12px;font-weight:700;color:#5c6470;cursor:pointer}
.day-switch button.on{background:#111827;color:#fff;border-color:#111827}
.pager{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}
.pager button{appearance:none;border:1px solid var(--line);background:#fff;border-radius:9px;width:30px;height:30px;font:inherit;font-weight:800;color:#5c6470;cursor:pointer}
.pager button:disabled{opacity:.4;cursor:default}
.meal-date{margin:0;font-size:12px}
.meal{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.meal-venue{padding:12px 14px;border-radius:14px;background:#f6f7f9;font-size:13px;line-height:1.6;min-width:0}
.meal-venue>b{display:block;font-size:13px;margin-bottom:4px}
.meal-lines{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:4px;overflow-wrap:anywhere}
.meal-lines b{display:block;font-size:12px;color:var(--muted);font-weight:700}
.meal-lines.clamped{max-height:9.6em;overflow:hidden;-webkit-mask-image:linear-gradient(180deg,#000 70%,transparent)}
.meal-more{margin-top:6px}
.meal-empty{margin:0;color:var(--muted)}
.meal-pick-list{display:flex;flex-direction:column;max-height:50vh;overflow:auto}
.meal-pick .pick-row{display:flex;align-items:center;gap:10px;cursor:pointer;min-width:0}
.meal-pick .pick-order{display:flex;gap:4px}
.meal-pick .pick-order .btn{min-width:36px;min-height:32px;padding:4px 8px}
.meal-pick-count{font-size:13px;margin:10px 0 0}
.switch-input{appearance:none;width:42px;height:24px;border-radius:99px;background:#d5d9e0;position:relative;flex:none;cursor:pointer;margin:0}
.switch-input::after{content:"";position:absolute;left:3px;top:3px;width:18px;height:18px;border-radius:50%;background:#fff;transition:left .15s}
.switch-input:checked{background:#111827}.switch-input:checked::after{left:21px}
.switch-input:focus-visible{outline:2px solid #2458c5;outline-offset:2px}
.toggle-row{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:10px 0;border-top:1px solid var(--line)}
.toggle-row:first-of-type{border-top:0}
@media(max-width:760px){.meal{grid-template-columns:1fr}}

/* Step 2 B1 R3: meal widget scrolls inside its card and uses one compact control row. */
.widget[data-widget-code="edu.meals"]{display:flex;flex-direction:column}
.widget[data-widget-code="edu.meals"] .widget-body{flex:1 1 auto;min-height:0;margin-top:12px;display:flex;flex-direction:column;overflow:hidden}
.widget[data-widget-code="edu.meals"] .meal-widget{flex:1 1 auto;min-height:0;gap:10px}
.meal-menu{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding-right:4px;scrollbar-width:thin;scrollbar-color:var(--wfix-scroll-thumb,#aeb9c5) transparent}
.meal-controls{display:flex;align-items:center;gap:6px 8px;flex-wrap:wrap}
.meal-seg{display:inline-flex;gap:2px;padding:3px;border-radius:10px;background:#f1f3f6}
.meal-seg button{appearance:none;border:0;background:transparent;border-radius:8px;min-height:28px;padding:3px 10px;font:inherit;font-size:12px;font-weight:700;color:#5c6470;cursor:pointer}
.meal-seg button.on{background:#fff;color:var(--text);box-shadow:0 1px 3px rgba(15,23,42,.1)}
.meal-pick-open{margin-left:auto;font-size:12px}
.meal-nav{display:flex;align-items:center;gap:8px;min-width:0;padding-top:2px}
.meal-where{flex:1;min-width:0;display:flex;align-items:baseline;gap:8px;flex-wrap:wrap}
.meal-where b{font-size:14px;letter-spacing:-.01em}
.meal-where .muted{font-size:12px}
.meal-step{appearance:none;border:1px solid var(--line);background:#fff;border-radius:8px;width:28px;height:28px;font:inherit;font-weight:800;color:#5c6470;cursor:pointer;flex:none}
.meal-step:disabled{opacity:.35;cursor:default}
.meal-menu{display:grid;gap:14px}
.meal-menu.cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}
.meal-menu .meal-venue{padding:0;background:transparent;border-radius:0}
.meal-menu.cols-2 .meal-venue{padding:12px 14px;border-radius:14px;background:#f6f7f9}
.meal-venue h4{margin:0 0 6px;font-size:13px}
.meal-lines{margin:0;display:block;font-size:13px;line-height:1.55;max-height:none;-webkit-mask-image:none}
.meal-lines dt{font-size:11.5px;font-weight:700;color:var(--muted);margin-top:10px}
.meal-lines dt:first-child{margin-top:0}
.meal-lines dd{margin:2px 0 0;color:var(--text);overflow-wrap:anywhere}
@media(max-width:760px){.widget[data-widget-code="edu.meals"] .widget-body{overflow:visible}.meal-menu{max-height:50vh}.meal-menu.cols-2{grid-template-columns:1fr}}

/* Step 3 same-window timetable link: the transit card and the confirm card in 내 정보 > 연결. */
.connect-card .connect-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:20px}
.link-return{margin-bottom:16px}
.link-return .link-return-status{margin:10px 0 0;font-size:13px;color:var(--muted)}
.link-return .link-return-status:empty{display:none}

/* Step 3 timetable.read: the "오늘 수업" card. Same frame as the meal widget: fixed controls, the list scrolls inside. */
.widget[data-widget-code="edu.timetable"]{display:flex;flex-direction:column}
.widget[data-widget-code="edu.timetable"] .widget-body{flex:1 1 auto;min-height:0;margin-top:12px;display:flex;flex-direction:column;overflow:hidden}
.class-widget{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;gap:10px}
.class-date{font-size:12px}
.class-body{flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior:contain;padding-right:4px;scrollbar-width:thin;scrollbar-color:var(--wfix-scroll-thumb,#aeb9c5) transparent}
.class-list{list-style:none;margin:0;padding:0;display:flex;flex-direction:column}
.class-row{display:flex;align-items:baseline;gap:12px;padding:9px 0;border-top:1px solid var(--line)}
.class-row:first-child{border-top:0;padding-top:2px}
.class-time{flex:none;min-width:92px;font-size:13px;font-variant-numeric:tabular-nums;color:#4b5563}
.class-what{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.class-what b{font-size:14px;letter-spacing:-.01em;overflow-wrap:anywhere}
.class-what .muted{font-size:12px;overflow-wrap:anywhere}
.class-row.past .class-time,.class-row.past .class-what b{color:#9aa3af;font-weight:600}
.class-now{flex:none;align-self:center;padding:2px 8px;border-radius:999px;background:#e7f6ec;color:#17643a;font-size:11.5px;font-weight:700}
@media(max-width:760px){.widget[data-widget-code="edu.timetable"] .widget-body{overflow:visible}.class-body{max-height:50vh}}
