/* Customer site theme: navy ink on cool gray, one blue for primary actions,
   orange for warnings/failures (distinguishable from blue without hue). Loaded last. */
:root{--bg:#f8f9fb;--surface:#fff;--text:#0b3558;--muted:#476788;--line:#d4e0ed;--accent:#006bff;--soft:#e6f0ff;--danger:#b4440e;--pebble:#f0f3f8;--warn-soft:#fff1e6;--info:#004eba;--shadow:0 4px 5px rgba(71,103,136,.04),0 4px 10px rgba(71,103,136,.03),0 10px 20px rgba(71,103,136,.05);font-family:"Manrope","Noto Sans KR","Apple SD Gothic Neo","Malgun Gothic",system-ui,sans-serif;font-size:15px}
body{background:var(--bg);color:var(--text)}
p{color:var(--muted)}
h1{font-size:32px;font-weight:800;letter-spacing:-.5px}
h2{font-size:19px;font-weight:700}

/* Controls: 8px corners, at least 44px tall */
button{border-radius:8px;min-height:44px;padding:10px 18px;font-size:15px;font-weight:700;background:var(--accent)}
button:hover{filter:brightness(.94)}
button:disabled{opacity:.45;cursor:not-allowed}
.quiet{color:var(--text);background:var(--surface);border-color:var(--line);font-weight:600}
.quiet:hover{background:var(--pebble);filter:none}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #006bff55;outline-offset:2px}
label{font-size:14px;font-weight:600;color:var(--muted)}
input,select,textarea{border-color:var(--line);background:var(--pebble);border-radius:8px;min-height:46px;color:var(--text);font-size:15px}
input[type=checkbox]{min-height:0;accent-color:var(--accent)}
input:focus,textarea:focus,select:focus{border-color:var(--accent);background:var(--surface);box-shadow:0 0 0 3px #006bff1f}

/* Frame */
header{height:68px;border-bottom-color:var(--line)}
header .brand .heavendm-logo{width:150px}
#identity{font-size:14px;color:var(--muted)}
aside{inset:68px auto 0 0;width:236px;background:var(--surface);border-right-color:var(--line);padding:24px 14px}
.nav-label{display:none}
nav button{min-height:48px;padding:0 16px;margin:2px 0;font-size:16px;font-weight:500;color:var(--text);border-radius:8px;display:flex;align-items:center;justify-content:space-between;gap:8px}
nav button:hover{background:var(--pebble);filter:none}
nav button.active{background:var(--soft);color:var(--accent);font-weight:700}
.nav-badge{font-size:12px;font-weight:700;border-radius:999px;padding:2px 8px;background:var(--warn-soft);color:var(--danger)}
.sidebar-note{font-size:13px;line-height:1.7;color:var(--muted);border-top-color:var(--line)}
main{margin:68px 0 0 236px;padding:36px 44px;max-width:1340px}
.page-title{margin-bottom:12px}
.eyebrow{display:none}
#notice{color:var(--accent);font-size:14px;font-weight:600}

/* Surfaces */
.card,.panel{border-color:var(--line);border-radius:16px;box-shadow:none}
.panel{border-radius:20px;margin-bottom:20px}
.cards{gap:16px}
.card{display:flex;flex-direction:column;gap:6px;padding:22px 24px}
.card .caption{font-size:13px;color:var(--muted)}
.card .value{font-size:30px;font-weight:800;margin:2px 0;color:var(--text)}
/* A dialog holding a long table: fixed height, one scroll area (the table), its header row stays in view. */
dialog.table-dialog[open]{display:flex;flex-direction:column;height:min(88vh,960px);max-height:88vh;overflow:hidden}
dialog.table-dialog #modal-body{flex:1 1 auto;min-height:0;display:flex;flex-direction:column;overflow:auto}
dialog.table-dialog #modal-error:empty{display:none}
dialog.table-dialog .table-scroll-host{flex:1 1 auto;min-height:220px;display:flex;flex-direction:column}
dialog.table-dialog .table-scroll-host>.table-wrap{flex:1 1 auto;min-height:0;max-height:none;overflow:auto}
dialog.table-dialog .table-scroll-host>.pager{margin:12px 0 0}
.order-status-filter{display:flex;flex-wrap:wrap;gap:8px;margin:4px 0 14px}
.order-status-filter button{min-height:40px;padding:0 14px;border-radius:999px}
.order-status-filter button.on{background:var(--accent);border-color:var(--accent);color:#fff}
.order-status-filter b{font-weight:800;margin-left:2px}
.card .value.ticket-split{display:flex;flex-wrap:wrap;gap:2px 18px}
.ticket-split span{display:inline-flex;align-items:baseline;gap:6px;white-space:nowrap}
.ticket-split small{font-size:15px;font-weight:700;color:var(--muted)}
.forms{max-width:none}
.hint{background:var(--pebble);color:var(--muted);font-size:14px;line-height:1.7;border-radius:12px}
.tag{border-radius:999px;padding:4px 10px;font-size:12px;font-weight:700;background:var(--soft);color:var(--info)}
.tag.bad{background:var(--warn-soft);color:var(--danger)}
.form-error,#modal-error,#login-error{color:var(--danger);font-size:14px}
dialog{border-radius:20px;border-color:var(--line);box-shadow:var(--shadow)}
dialog::backdrop{background:#0b355866}

/* Tables */
.table-wrap{border-color:var(--line);border-radius:16px}
table{font-size:14px}
th{background:var(--pebble);color:var(--muted);font-size:13px}
td,th{padding:13px 16px;border-bottom-color:#e8eef5}
tbody tr:hover{background:#f4f8ff}
.pager{font-size:14px}

/* Login */
.login{border-radius:24px;border-color:var(--line);box-shadow:0 30px 50px rgba(71,103,136,.08);padding:40px}
.login h1{font-size:26px}
.login form button,.wide{min-height:52px;font-size:17px}
.login-intro{display:block;margin-top:14px;text-align:center;font-size:14px;font-weight:600;color:var(--muted);text-decoration:none}.login-intro:hover{color:var(--accent)}

/* Home */
.home-head{display:flex;justify-content:space-between;align-items:flex-end;gap:20px;flex-wrap:wrap;margin-bottom:24px}
.home-head h2{font-size:30px;font-weight:800;letter-spacing:-.5px;margin:4px 0 0}
.home-head p{margin:0;font-size:16px}
.cta{min-height:54px;padding:0 26px;font-size:18px;box-shadow:var(--shadow)}
.must-banner{display:flex;align-items:center;gap:24px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--line);border-radius:24px;padding:24px 30px;margin-bottom:24px;box-shadow:var(--shadow)}
.must-banner>div{flex:1 1 300px}
.must-banner .label{margin:0 0 4px;font-size:13px;font-weight:800;color:var(--danger)}
.must-banner strong{display:block;font-size:20px;line-height:1.4}
.must-banner p{margin:4px 0 0;font-size:14px}
.steps{list-style:none;margin:0;padding:0;display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.steps li{display:flex;align-items:center;gap:8px;background:var(--pebble);border-radius:999px;padding:10px 16px;font-size:15px;font-weight:600}
.steps li.first{background:var(--warn-soft);color:var(--danger);font-weight:800}
.steps li b{width:24px;height:24px;border-radius:999px;background:var(--text);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-size:13px}
.steps li.first b{background:var(--danger)}
.meter{height:8px;background:var(--pebble);border-radius:999px;overflow:hidden;margin-top:4px}
.meter i{display:block;height:100%;border-radius:999px;background:var(--accent)}
.meter.warn i{background:var(--danger)}
.home-grid{display:grid;grid-template-columns:minmax(0,1fr) 420px;gap:20px;align-items:start}
.quick{display:grid;gap:12px}
/* Quick-action buttons follow the button artwork in tg-dm-platform/artifacts/buttons. */
.quick .quick-button{display:flex;align-items:center;gap:14px;min-height:84px;text-align:left;background:var(--surface);color:var(--text);border:1.5px solid var(--line);border-radius:18px;padding:10px 16px 10px 10px;box-shadow:0 4px 10px rgba(71,103,136,.05)}
.quick .quick-button.must{border-color:#f5c7a6}
.quick .quick-button:hover{background:var(--surface);border-color:var(--accent);filter:none;box-shadow:0 6px 16px rgba(0,107,255,.12)}
.quick .quick-button.must:hover{border-color:var(--danger)}
.quick-button img{width:56px;height:56px;flex:none}
.quick-text{flex:1;min-width:0}
.quick-title{display:flex;align-items:center;gap:8px;white-space:nowrap;font-size:17px;font-weight:800;letter-spacing:-.2px}
.quick-title .nav-badge{font-size:11px;padding:2px 8px;white-space:nowrap}
.quick small{display:block;font-size:13px;font-weight:500;color:var(--muted);margin-top:3px}
.quick-arrow{width:22px;height:22px;flex:none;fill:none;stroke:var(--accent);stroke-width:2.4;stroke-linecap:round;stroke-linejoin:round;transition:transform .15s}
.quick-button:hover .quick-arrow{transform:translateX(3px)}
.home-grid .toolbar{justify-content:space-between}
.home-grid h2{margin:0}
textarea{min-height:130px}
.approval{border-left:0;background:var(--warn-soft);color:var(--danger);border-radius:12px;padding:14px 18px;font-weight:600;margin:0 0 20px}

/* Send precheck */
#precheck{margin:4px 0 16px}
.precheck-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px}
.precheck-grid div{border-radius:14px;padding:14px 16px;background:var(--pebble);color:var(--muted)}
.precheck-grid strong{display:block;font-size:26px;font-weight:800;margin:2px 0}
.precheck-grid span{font-size:13px;font-weight:700}
.precheck-grid small{display:block;font-size:12px}
.precheck-grid .ok{background:var(--soft);color:var(--info)}
.precheck-grid .need{background:var(--warn-soft);color:var(--danger)}
.precheck-alert{display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;border:2px solid var(--danger);background:#fffaf6;border-radius:14px;padding:16px 18px;margin-top:12px}
.precheck-alert p{margin:0;font-size:14px}
.precheck-alert strong{color:var(--danger);font-size:16px}
.precheck-alert button{background:var(--danger)}
.precheck-note{font-size:14px;margin:10px 0 0}
.precheck-note.warn{color:var(--danger);font-weight:600}

/* Lookup page summary */
.info-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px;margin-bottom:20px}
.info-cards>div{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:18px 22px}
.info-cards span{font-size:13px;color:var(--muted)}
.info-cards strong{display:block;font-size:24px;font-weight:800;margin:4px 0 6px}
.info-cards strong small{font-size:14px;font-weight:600;color:var(--muted)}
.info-cards>div>small{display:block;font-size:13px;color:var(--muted)}
.info-cards .meter{height:8px;margin-top:8px}
.page-sub{margin:-14px 0 22px;font-size:15px}
.panel-head{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:12px}
.panel-head h2{margin:0}
.file-button{display:inline-flex;align-items:center;min-height:44px;padding:0 16px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);font-size:14px;font-weight:700;cursor:pointer}
.file-button:hover{background:var(--pebble)}
.file-button:focus-within{outline:3px solid #006bff55;outline-offset:2px}
.file-button input{position:absolute;width:1px;height:1px;opacity:0}
.lookup-count{display:flex;flex-wrap:wrap;align-items:center;gap:8px 20px;background:var(--pebble);border-radius:12px;padding:14px 18px;margin:12px 0;font-size:14px;color:var(--muted)}
.lookup-count b{color:var(--text)}
.lookup-count .total{margin-left:auto;font-size:16px;color:var(--text)}
.lookup-count .total b{color:var(--accent)}
.lookup-count .warn{color:var(--danger);font-weight:700}
.form-actions{display:flex;justify-content:flex-end}
.lookup-new .form-actions button{min-height:52px;padding:0 28px;font-size:17px}

/* Existing feature styles retinted */
.report-bar .sent{background:var(--accent)}
.report-bar .failed{background:#f59f63}
.report-bar .pending{background:#c9d6e4}
.loading-ring{border-color:var(--soft);border-top-color:var(--accent)}
#page-transition{border-radius:14px;border-color:var(--line)}
.template-preview{border-color:var(--line);border-radius:16px;background:#dfe9f3}
.template-preview img{background:var(--pebble)}
.template-caption{background:var(--surface)}
.template-buttons a,.template-buttons span{border-color:transparent;background:#ffffffc0;color:var(--text);border-radius:10px}
#template-upload [data-button-fields]{border-color:var(--line);border-radius:12px}
.message{background:var(--surface);border:1px solid var(--line);border-radius:16px;max-width:80%}
.message.out{background:var(--accent);border-color:var(--accent);color:#fff;margin-left:auto}
.message.out small{color:#ffffffcc}
.message.out.pending{background:var(--surface);color:var(--text);border:1px dashed var(--accent)}
.message.out.pending .pending-note{color:var(--accent);font-weight:700}
.thread{background:var(--bg);border-radius:16px;padding:12px 16px;display:flex;flex-direction:column}
#conversation-list .wide{text-align:left;min-height:56px;margin:0 0 6px}
.ticket-product{border-radius:20px}
.lookup-results #lookup-feedback{color:var(--accent)}
.lookup-results th{background:var(--pebble)}

@media(max-width:1050px){aside{width:190px}main{margin-left:190px;padding:24px}.home-grid{grid-template-columns:1fr}}
@media(max-width:650px){aside{position:static;width:auto;margin-top:68px;padding:10px}nav{display:flex;overflow:auto;gap:4px}nav button{white-space:nowrap;width:auto}main{margin:0;padding:18px 16px}h1{font-size:26px}.home-head h2{font-size:24px}.must-banner{padding:20px}.card .value{font-size:24px}header .brand .heavendm-logo{width:120px}}

/* ===== Redesign pages (customer-pages.js) ===== */
button,input,select,textarea{font-family:inherit}
.dark{background:var(--text);color:#fff;border-color:var(--text)}
.header-side{display:flex;align-items:center;gap:10px}
.balance-chip{display:inline-flex;align-items:center;gap:8px;background:var(--pebble);border-radius:999px;padding:8px 16px;font-size:14px;color:var(--muted)}
.balance-chip strong{font-size:16px;color:var(--text)}
.chip-tickets{display:inline-flex;align-items:center;gap:6px;margin-left:6px;padding-left:12px;border-left:1px solid var(--line)}
.chip-tickets[hidden]{display:none}
.chip-tickets strong{font-size:15px;margin-right:6px}
#header-charge{min-height:42px;padding:0 16px}
#logout{min-height:40px;padding:0 14px;font-size:14px}
#page-desc{margin:4px 0 0;font-size:15px;color:var(--muted)}
#page-desc:empty{display:none}
#refresh{min-height:40px;padding:0 14px;font-size:14px}
.nav-count{min-width:22px;height:22px;border-radius:999px;background:var(--accent);color:#fff;font-size:12px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;padding:0 6px}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{min-height:38px;padding:0 16px;border-radius:999px;background:var(--surface);color:var(--text);border:1px solid var(--line);font-size:14px;font-weight:700}
.chip:hover{background:var(--pebble);filter:none}
.chip.on{background:var(--text);border-color:var(--text);color:#fff}
.empty-note{color:var(--muted);font-size:14px;margin:8px 0}
/* Empty state with an action: the text wraps on its own, the button sits on its own line below it. */
.empty-action{display:flex;flex-direction:column;align-items:flex-start;gap:12px;margin:8px 0}
.empty-action .empty-note{margin:0;line-height:1.7;word-break:keep-all}
.button-link{display:inline-flex;align-items:center;min-height:44px;padding:0 16px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);font-size:14px;font-weight:700;text-decoration:none}
.button-link:hover{background:var(--pebble)}
.warn{color:var(--danger)}

/* Send flow */
.stepper{list-style:none;display:flex;gap:8px;flex-wrap:wrap;margin:0 0 18px;padding:0}
.stepper li{display:flex;align-items:center;gap:8px;padding:8px 16px;border-radius:999px;background:var(--pebble);color:var(--muted);font-weight:700;font-size:14px}
.stepper li b{width:24px;height:24px;border-radius:999px;background:var(--line);color:var(--text);display:inline-flex;align-items:center;justify-content:center;font-size:13px}
.stepper li.on{background:var(--soft);color:var(--accent)}
.stepper li.on b{background:var(--accent);color:#fff}
.send-flow{max-width:none;display:grid;gap:20px;margin-bottom:20px}
.send-flow .panel{margin:0}
.step h2{font-size:20px}
.step-nav{display:flex;justify-content:space-between;gap:12px;margin-top:18px}
.pick-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:14px}
.pick{display:flex;flex-direction:column;align-items:stretch;gap:6px;text-align:left;background:var(--surface);color:var(--text);border:2px solid var(--line);border-radius:16px;padding:10px;min-height:0;font-weight:600}
.pick:hover{border-color:#9fbbe0;filter:none}
.pick.on{border-color:var(--accent);box-shadow:0 0 0 3px #006bff22}
.pick img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px;background:var(--pebble)}
.pick strong{font-size:15px;margin-top:4px}
.pick small{font-size:12px;color:var(--muted);font-weight:500}
.pick-buttons{display:grid;gap:4px;margin-top:2px}
.pick-buttons span{display:block;text-align:center;padding:7px 8px;border-radius:8px;background:var(--soft);color:var(--info);font-size:12px;font-weight:700;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.send-summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:10px;margin:0 0 14px}
.send-summary div{background:var(--pebble);border-radius:12px;padding:14px 16px}
.send-summary dt{font-size:13px;color:var(--muted);font-weight:600}
.send-summary dd{margin:4px 0 0;font-size:16px;font-weight:700}
.send-summary small{font-size:12px;font-weight:500}
#send-submit{min-height:54px;padding:0 28px;font-size:17px}
.send-done{text-align:center;padding:36px 24px}
.done-mark{width:56px;height:56px;margin:0 auto 10px;border-radius:999px;border:3px solid var(--accent);color:var(--accent);font-size:28px;font-weight:800;display:flex;align-items:center;justify-content:center}
.send-done h2{font-size:24px;margin:0 0 6px}
.done-actions{display:flex;justify-content:center;gap:10px;margin-top:14px;flex-wrap:wrap}

/* Results · statistics */
.results-bar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:16px}
.date-range{display:flex;align-items:center;gap:8px;color:var(--muted)}
.date-range input{min-height:40px;padding:0 10px;font-size:14px;width:auto}
.stats-grid{display:grid;grid-template-columns:minmax(0,1fr) 360px;gap:20px;margin:20px 0}
.stats-grid .panel{margin:0}
.legend{display:flex;align-items:center;gap:6px;font-size:13px;color:var(--muted)}
.legend i{width:10px;height:10px;border-radius:3px;display:inline-block;margin-left:8px}
.legend .sent,.day-chart .sent{background:var(--accent)}
.legend .failed,.day-chart .failed{background:#f59f63}
.legend .cancelled,.day-chart .cancelled{background:#6b7f99}
.legend .pending,.day-chart .pending{background:#c9d6e4}
.day-chart{display:flex;align-items:flex-end;gap:6px;height:240px;padding:20px 0 28px;border-bottom:1px solid var(--line);overflow-x:auto}
.day-chart .report-chart-row{flex:1 0 26px;max-width:56px;height:100%;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:4px;position:relative}
.day-chart .report-chart-row b{font-size:11px;color:var(--muted)}
.day-chart .col{width:70%;min-height:2px;display:flex;flex-direction:column-reverse;border-radius:6px 6px 0 0;overflow:hidden}
.day-chart .col i{display:block;flex-basis:0;min-height:0}
.day-chart .report-chart-row span{position:absolute;bottom:-24px;font-size:11px;color:var(--muted);white-space:nowrap}
.reason-list{display:grid;gap:12px}
.reason>div:first-child{display:flex;justify-content:space-between;gap:10px;font-size:14px}
.reason b{white-space:nowrap}
.sub-head{margin-top:22px;font-size:16px}
.table-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.table-tools input{min-height:44px;width:220px}
.table-tools select{min-height:44px;width:auto}
.table-tools .table-refresh{min-height:44px;padding:0 14px}

/* Templates */
.tpl-layout{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:24px;align-items:start;margin-bottom:20px}
.tpl-form,#template-upload.tpl-form{margin:0;display:block;max-width:none}
#template-upload.tpl-form>label,#template-upload.tpl-form .button-row{margin-bottom:14px}
#template-upload .button-row[hidden]{display:none}
.tpl-form h2{font-size:22px}
.dropzone{position:relative;display:flex;align-items:center;justify-content:center;min-height:120px;margin-top:6px;border:2px dashed var(--line);border-radius:14px;background:var(--pebble);color:var(--text);font-weight:700;text-align:center;padding:12px}
.dropzone:hover,.dropzone:focus-within{border-color:var(--accent);background:var(--soft)}
.dropzone input{position:absolute;inset:0;opacity:0;cursor:pointer;min-height:0;width:100%;height:100%}
/* 첨부: 파일 선택 · 붙여넣기 버튼, 넣은 뒤에는 작은 그림과 바꾸기·삭제 (customer-pages.js templateMediaField) */
.tpl-media{margin-bottom:14px}
.tpl-media [hidden]{display:none}
.tpl-media-label{font-size:14px;font-weight:600;color:var(--muted)}
.tpl-media .dropzone{flex-direction:column;gap:12px;min-height:156px}
.dz-actions{position:relative;z-index:1;display:flex;flex-wrap:wrap;gap:8px;justify-content:center}
.dz-paste,.dz-paste:hover{border-color:var(--accent);color:var(--info);font-weight:700}
.dz-remove{color:var(--danger)}
.dz-hint{font-size:14px;font-weight:500;color:var(--muted)}
.dz-hint kbd{display:inline-block;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--text);padding:1px 8px;font:inherit;font-size:13px;font-weight:700}
.dz-got{display:flex;align-items:center;gap:14px;min-height:156px;margin-top:6px;padding:14px;border:2px solid var(--accent);border-radius:14px;background:var(--surface)}
.dz-thumb{flex:none;width:120px;height:90px;border-radius:10px;overflow:hidden;background:var(--pebble);display:flex;align-items:center;justify-content:center;color:var(--muted);font-size:14px;font-weight:700}
.dz-thumb img{width:100%;height:100%;object-fit:cover;display:block}
.dz-info{display:flex;flex-direction:column;gap:8px;min-width:0}
.dz-info strong{overflow-wrap:anywhere}
.dz-info .dz-actions{justify-content:flex-start}
@media(max-width:600px){.dropzone .dz-actions{width:100%;flex-direction:column}.dz-got{flex-direction:column;align-items:stretch}.dz-thumb{width:100%;height:auto;aspect-ratio:16/9}.dz-info .dz-actions{display:grid;grid-template-columns:1fr 1fr}}
.button-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}
#template-upload .button-row{border:0;padding:0}
.tpl-preview-col{position:sticky;top:90px}
.tpl-preview-col h2{font-size:17px}
.phone-frame{background:#dfe9f3;border-radius:24px;padding:18px}
.phone-frame .template-preview{margin:0;border:0;background:transparent;padding:0}
.phone-frame #template-image-preview,.img-empty{width:100%;border-radius:14px 14px 0 0;display:block}
.phone-frame #template-image-preview[hidden],.img-empty[hidden]{display:none}
.img-empty{aspect-ratio:4/3;background:#f0f3f8;color:var(--muted);display:flex;align-items:center;justify-content:center;font-size:13px}
.phone-frame .template-caption{border-radius:0 0 14px 14px;padding:12px 14px;min-height:20px;white-space:pre-wrap;font-size:14px}
.phone-frame .template-buttons{display:grid;gap:6px;margin-top:6px}
.phone-frame .template-buttons span{display:block;text-align:center;padding:10px;border-radius:10px;background:#ffffffd0;font-weight:700;font-size:14px}
.tpl-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:16px}
.tpl-card{margin:0;padding:12px;display:flex;flex-direction:column;gap:8px;border-radius:16px}
.tpl-card[hidden]{display:none}
.tpl-thumb img{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px;background:var(--pebble);display:block}
.tpl-meta{display:flex;justify-content:space-between;align-items:center;gap:8px}
.tpl-meta strong{font-size:16px}
.tpl-note{margin:0;font-size:13px;color:var(--danger)}
.tpl-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:auto}
.tpl-actions button{min-height:40px;padding:0 12px;font-size:14px}

/* Chat */
.chat-shell{display:grid;grid-template-columns:300px minmax(0,1fr);background:var(--surface);border:1px solid var(--line);border-radius:20px;overflow:hidden;min-height:620px}
.chat-list{border-right:1px solid var(--line);display:flex;flex-direction:column;min-height:0}
.chat-tools{padding:14px;display:grid;gap:10px;border-bottom:1px solid var(--line)}
/* 내 대화 필터: 같은 너비 4칸, 이름 위 숫자 아래 */
.chat-seg{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:3px;padding:3px;background:var(--pebble);border-radius:12px}
.chat-seg .seg{min-height:0;padding:7px 2px 6px;border-radius:9px;background:transparent;color:var(--muted);display:grid;gap:1px;justify-items:center;font-weight:600;line-height:1.2}
.chat-seg .seg span{font-size:12px;white-space:nowrap}
.chat-seg .seg b{font-size:15px;font-weight:800;color:var(--text);font-variant-numeric:tabular-nums}
.chat-seg .seg.zero b{color:#9aabbd}
.chat-seg .seg:hover{background:#fff9;filter:none}
.chat-seg .seg.on{background:var(--surface);color:var(--accent);box-shadow:0 1px 3px rgba(11,53,88,.12)}
.chat-seg .seg.on b{color:var(--accent)}
.chat-seg .seg[data-filter=unread]:not(.zero) b{color:var(--accent)}
#conversation-list{overflow-y:auto;max-height:560px;padding:0}
.conv{display:flex;align-items:center;gap:10px;width:100%;text-align:left;background:transparent;color:var(--text);border:0;border-radius:0;border-bottom:1px solid #eef2f7;padding:12px 14px;min-height:68px;font-weight:500;margin:0}
.conv:hover{background:var(--pebble);filter:none}
.conv.on{background:var(--soft)}
.avatar{flex:none;width:38px;height:38px;border-radius:999px;background:var(--text);color:#fff;font-weight:800;display:flex;align-items:center;justify-content:center}
.conv-body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.conv-top{display:flex;justify-content:space-between;gap:6px}
.conv-top strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.conv-top small{flex:none;font-size:11px;color:var(--muted)}
.conv-last{font-size:13px;color:var(--muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.unread{flex:none;min-width:22px;height:22px;border-radius:999px;background:var(--accent);color:#fff;font-size:12px;font-weight:800;display:flex;align-items:center;justify-content:center;padding:0 6px}
.chat-main{display:flex;flex-direction:column;min-width:0}
.chat-head{display:flex;align-items:baseline;gap:10px;flex-wrap:wrap;padding:16px 22px;border-bottom:1px solid var(--line)}
.chat-head strong{font-size:17px}
.chat-head span{font-size:13px;color:var(--muted)}
.chat-main .thread{flex:1;border-radius:0;margin:0;min-height:360px;max-height:520px;overflow-y:auto;padding:18px 22px;gap:8px}
.chat-reply{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:10px;padding:14px 22px;border-top:1px solid var(--line);margin:0;max-width:none}
.chat-reply label{margin:0}
.chat-reply textarea{min-height:64px;height:64px}
.chat-reply button[type=submit]{min-height:52px;padding:0 24px}
.chat-reply [data-form-status]{grid-column:1/-1;margin:0}
.chat-reply .reply-locked{grid-column:1/-1;margin:0;padding:8px 12px;border-radius:10px;background:var(--warn-soft);color:#8a4b00;font-size:13px;font-weight:600}
.chat-reply.locked textarea{background:var(--pebble);cursor:not-allowed}
.chat-reply.locked button[type=submit]{opacity:.45;cursor:not-allowed}

/* Wallet */
.wallet-cards{grid-template-columns:repeat(3,minmax(0,1fr))}
.wallet-cards.four{grid-template-columns:repeat(4,minmax(0,1fr))}
.card.dark{background:var(--text);border-color:var(--text)}
.card.dark .caption,.card.dark .value{color:#fff}
.card.dark .caption{opacity:.85}
.wallet-grid{display:grid;grid-template-columns:minmax(0,1fr) 340px;gap:20px;align-items:start;margin:20px 0}
.wallet-grid .panel{margin:0}
.seg{display:inline-flex;background:var(--pebble);border-radius:12px;padding:4px;gap:4px;margin-bottom:14px}
.seg button{min-height:40px;background:transparent;color:var(--muted);border:0;padding:0 16px;font-size:14px}
.seg button.on{background:var(--surface);color:var(--text);box-shadow:0 1px 3px rgba(11,53,88,.12)}
.deposit-box{display:flex;gap:18px;align-items:center;border:1px solid var(--line);border-radius:16px;padding:16px;flex-wrap:wrap}
.deposit-box .qr{width:132px;height:132px;border-radius:10px;background:var(--pebble);border:0;margin:0}
.deposit-box>div{flex:1;min-width:220px}
.deposit-box .address{background:var(--pebble);border-radius:10px;padding:12px 14px;font-family:ui-monospace,Consolas,monospace;font-size:14px;word-break:break-all;margin:6px 0 10px;color:var(--text)}
.notes{margin:16px 0;padding-left:20px;color:var(--muted);font-size:14px;line-height:1.8}
.claim{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px;align-items:end;max-width:none}
.claim label{margin:0}
.claim [data-form-status]{grid-column:1/-1}
.product-list{display:grid;gap:10px;margin:12px 0}
.product{display:flex;justify-content:space-between;align-items:center;gap:10px;border:1px solid var(--line);border-radius:14px;padding:12px 14px}
.product strong{display:block;font-size:18px}
.product small{font-size:12px;color:var(--muted)}
.product button{min-height:40px;padding:0 16px}

@media(max-width:1050px){.stats-grid,.tpl-layout,.wallet-grid{grid-template-columns:1fr}.tpl-preview-col{position:static}.wallet-cards{grid-template-columns:1fr}.chat-shell{grid-template-columns:240px minmax(0,1fr)}}
@media(max-width:650px){.balance-chip{display:none}.header-side{gap:6px}#identity{display:none}.chat-shell{grid-template-columns:1fr}.chat-list{border-right:0;border-bottom:1px solid var(--line)}#conversation-list{max-height:260px}.button-row{grid-template-columns:1fr}.claim,.chat-reply{grid-template-columns:1fr}.table-tools input{width:100%}.step-nav{flex-wrap:wrap}}
@media(max-width:1050px){.wallet-cards.four{grid-template-columns:repeat(2,minmax(0,1fr))}.chip-tickets{display:none}}
@media(max-width:650px){.wallet-cards.four{grid-template-columns:1fr}}
/* Video templates */
.template-preview video{display:block;width:100%;max-height:420px;background:#0b3558}
.pick-media{position:relative;display:block}
.pick-media img,.pick-media video{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px;background:var(--pebble);display:block}
.play-mark{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:44px;height:44px;border-radius:999px;background:rgba(255,255,255,.92);color:#0b3558;display:flex;align-items:center;justify-content:center;font-size:16px;padding-left:3px;box-sizing:border-box}
.tpl-thumb video{width:100%;aspect-ratio:4/3;object-fit:cover;border-radius:10px;background:#0b3558;display:block}
.phone-frame #template-video-preview{width:100%;display:block;border-radius:14px 14px 0 0;background:#0b3558}
.phone-frame #template-video-preview[hidden]{display:none}
/* Coin amounts and the exchange-rate notice on the charge page */
.coin{display:inline-flex;align-items:center;gap:8px;font-weight:800;white-space:nowrap}
.coin img{flex:none;width:22px;height:22px}
.coin-head{margin:0 0 14px;font-size:22px}
.coin-head .coin img{width:30px;height:30px}
.rate-note{display:grid;grid-template-columns:auto 1fr;align-items:center;column-gap:10px;row-gap:2px;margin:0 0 14px;padding:12px 14px;border-radius:12px;background:var(--soft);color:var(--text);font-size:14px}
.rate-note img{grid-row:span 2}
.rate-note strong{font-size:16px}
.rate-note small{color:var(--muted);font-size:12px}
td.txid{font-family:ui-monospace,Consolas,monospace;font-size:13px;color:var(--muted)}
/* Lookup kind tabs and the automatic-check notice on the send page */
.seg.lookup-kinds{display:flex;width:max-content;margin:0 0 14px}
.seg.lookup-kinds button{min-height:44px;padding:0 20px;font-size:15px;font-weight:700}
.precheck-grid .auto{background:var(--soft);color:var(--info)}
.precheck-info{margin-top:12px;padding:14px 18px;border-radius:14px;background:var(--soft);border:1px solid #b9d4ff;color:var(--text)}
.precheck-info strong{display:block;font-size:15px}
.precheck-info p{margin:4px 0 0;font-size:14px}
/* "추천" (recommended) instead of "필수": blue, not the warning orange */
.nav-badge.rec{background:var(--soft);color:var(--info)}
.must-banner.rec .label{color:var(--accent)}
.must-banner.rec .steps li.first{background:var(--soft);color:var(--info)}
.must-banner.rec .steps li.first b{background:var(--accent)}
.quick .quick-button.must{border-color:#b9d4ff}
.quick .quick-button.must:hover{border-color:var(--accent)}
/* Send-hours notice on the send page */
.send-hours{margin:0 0 12px;padding:12px 16px;border-radius:12px;background:var(--soft);color:var(--text);font-size:14px}
.send-hours.closed{background:var(--warn-soft);color:#8a3a10}

/* Keep the five send totals aligned on desktop; wrap on smaller screens. */
@media(min-width:1100px){.send-summary{grid-template-columns:repeat(5,minmax(0,1fr))}.send-summary dd{overflow-wrap:anywhere}}

.chat-person { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.chat-list-back { display: none; }

@media (max-width: 850px) {
  .chat-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    height: max(320px, calc(100dvh - 220px));
  }
  .chat-shell .chat-list { min-width: 0; border: 0; }
  .chat-shell #conversation-list { flex: 1; min-height: 0; max-height: none; }
  .chat-shell .chat-main { display: none; min-height: 0; }
  .chat-shell.thread-open .chat-list { display: none; }
  .chat-shell.thread-open .chat-main { display: flex; }
  .chat-list-back {
    display: inline-flex; align-items: center; justify-content: center; gap: 5px;
    min-height: 44px; padding: 0 10px; color: var(--accent); background: var(--soft);
  }
  .chat-head { align-items: center; gap: 8px; padding: 6px 10px; }
  .chat-head #chat-head { flex: 1; min-width: 0; overflow-wrap: anywhere; }
  .chat-main .thread { min-height: 0; max-height: none; padding: 12px; }
  .chat-main .message { min-width: 0; max-width: 100%; }
  .chat-reply { grid-template-columns: minmax(0,1fr) auto; gap: 6px; padding: 8px 10px; }
  .chat-reply label { min-width: 0; gap: 3px; }
  .chat-reply textarea { height: 46px; min-height: 46px; font-size: 16px; }
  .chat-reply button[type=submit] { min-height: 46px; padding: 0 14px; }
  .chat-reply [data-form-status]:empty { display: none; }
}
@media (max-width: 650px) {
  body[data-role=customer] #app > main:has(.chat-shell) {
    display: flex; flex-direction: column; height: calc(100dvh - 64px);
    min-height: 350px; padding: 10px 10px max(8px, env(safe-area-inset-bottom));
  }
  main:has(.chat-shell) .page-title { margin-bottom: 6px; }
  main:has(.chat-shell) #notice:empty { display: none; }
  #content:has(> .chat-shell) { flex: 1; min-height: 0; }
  #content > .chat-shell { height: 100%; border-radius: 14px; }
  /* Keep the existing refresh control on the same row as the open conversation. */
  body[data-role=customer] #app > main:has(.chat-shell.thread-open) {
    display: grid;
    grid-template-areas: "notice" "chat";
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-columns: minmax(0, 1fr);
  }
  main:has(.thread-open) > #notice { grid-area: notice; }
  main:has(.thread-open) > #content { grid-area: chat; }
  main:has(.chat-shell.thread-open) > .page-title {
    grid-area: chat;
    align-self: start;
    justify-self: end;
    margin: 5px 7px 0 0;
    z-index: 1;
  }
  main:has(.thread-open) > .page-title > div { display: none; }
  main:has(.thread-open) #refresh {
    width: 68px; min-height: 44px; padding: 0; font-size: 13px;
  }
  .thread-open .chat-head {
    flex-wrap: nowrap; gap: 6px; padding: 4px 80px 4px 6px;
  }
  .thread-open .chat-person { flex-wrap: nowrap; gap: 5px; }
  .thread-open .chat-person > * {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .thread-open .chat-person strong { flex-shrink: 0; max-width: 100%; }
  .thread-open .chat-person .caption { display: none; }
  .thread-open .handoff-banner {
    flex-wrap: wrap; gap: 4px 8px; margin: 4px 6px 0; padding: 6px 8px;
  }
  .thread-open .handoff-banner p { flex: 1 1 12rem; overflow-wrap: anywhere; }
}

/* 발송 요약 시안 A: 입력·발송 제외·발송 대상(강조) — sendsumA-1796293000 */
.precheck-grid.v3{grid-template-columns:repeat(auto-fit,minmax(150px,1fr))}
.precheck-grid .ex{background:var(--warn-soft);color:var(--danger)}
.precheck-grid .go{background:var(--soft);color:var(--info);outline:2px solid var(--info);outline-offset:-2px}
.precheck-grid .go strong{font-size:30px}
.precheck-foot{font-size:13px;color:var(--muted);margin:10px 0 0;line-height:1.55}
.send-summary .go{background:var(--soft);outline:2px solid var(--info);outline-offset:-2px}
.send-summary .go dt{color:var(--info)}
.send-summary .go dd{color:var(--info)}
