:root {
  --navy: #0b2447;
  --navy-2: #183b65;
  --blue: #1769aa;
  --cyan: #18a8bb;
  --ink: #142033;
  --muted: #68758a;
  --line: #dfe5ec;
  --soft: #f2f5f8;
  --surface: #ffffff;
  --danger: #b42318;
  --amber: #a15c00;
  --green: #087a55;
  --shadow: 0 18px 45px rgba(20, 32, 51, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; color-scheme: light; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f5f7fa; color: var(--ink); font-family: Inter, "Noto Sans KR", "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.kicker { margin: 0 0 8px; color: var(--cyan); font-size: 11px; font-weight: 850; letter-spacing: .14em; }

.public-header, .admin-header { position: sticky; top: 0; z-index: 30; min-height: 64px; padding: 0 clamp(18px, 4vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid rgba(223,229,236,.95); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
.brand { min-width: 0; display: inline-flex; align-items: center; gap: 14px; }
.brand img { width: 102px; max-height: 42px; object-fit: contain; object-position: left center; display: block; }
.brand span { padding-left: 14px; border-left: 1px solid var(--line); color: #516078; font-size: 11px; font-weight: 850; letter-spacing: .1em; white-space: nowrap; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.header-actions select, .login-bottom select { width: auto; min-width: 90px; margin: 0; }

input, select, textarea { width: 100%; margin-top: 7px; border: 1px solid #cfd7e2; border-radius: 6px; background: #fff; color: var(--ink); outline: 0; transition: border-color .15s, box-shadow .15s; }
input, select { height: 44px; padding: 0 12px; }
textarea { min-height: 92px; padding: 10px 12px; resize: vertical; white-space: pre-wrap; overflow-wrap: anywhere; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(23,105,170,.13); }
input:disabled, select:disabled, textarea:disabled { color: #59677a; background: #f3f5f7; }
label { min-width: 0; color: #415068; font-size: 12px; font-weight: 760; }
label > b { margin-left: 4px; color: var(--danger); }
.readonly-field { width: 100%; height: 44px; margin-top: 7px; padding: 0 12px; display: flex; align-items: center; border: 1px solid #cfd7e2; border-radius: 6px; color: #59677a; background: #f3f5f7; font-weight: 500; }

.button { min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-weight: 800; transition: .15s; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .55; cursor: wait; transform: none; }
.button.primary { color: #fff; background: var(--navy); }
.button.dark { color: #fff; background: #122033; }
.button.secondary { border-color: #ccd5df; background: #fff; }
.button.ghost { border-color: transparent; background: transparent; }
.button.danger-soft { border-color: #f0c5c0; color: var(--danger); background: #fff6f5; }
.button.small { min-height: 34px; padding: 0 12px; font-size: 11px; }
.button.full { width: 100%; min-height: 48px; }
.icon-button { width: 38px; height: 38px; border: 0; background: transparent; cursor: pointer; font-size: 24px; line-height: 1; }

.public-page { background: linear-gradient(145deg, #edf3f8 0%, #f7f9fb 50%, #ecf5f4 100%); }
.public-shell { width: min(1120px, calc(100% - 40px)); min-height: calc(100vh - 126px); margin: 0 auto; padding: clamp(42px, 7vw, 92px) 0 60px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(430px, .86fr); align-items: center; gap: clamp(38px, 7vw, 90px); }
.public-copy { position: relative; min-width: 0; }
.public-copy h1 { max-width: 620px; margin: 0; color: var(--navy); font-size: clamp(34px, 5vw, 58px); line-height: 1.07; letter-spacing: -.035em; }
.public-copy > p:not(.kicker) { max-width: 570px; margin: 18px 0 0; color: var(--muted); font-size: 15px; }
.product-visual { width: min(360px, 70%); aspect-ratio: 4 / 3; margin: 0 0 34px auto; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.8); border-radius: 22px; background: rgba(255,255,255,.5); box-shadow: 0 28px 60px rgba(11,36,71,.12); }
.product-visual img { width: 90%; height: 90%; object-fit: contain; }
.public-steps { margin: 34px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); list-style: none; border-top: 1px solid #cad4df; }
.public-steps li { padding: 14px 8px 0 0; }
.public-steps span { display: block; color: var(--cyan); font-size: 10px; font-weight: 900; }
.public-steps b { display: block; margin-top: 3px; font-size: 12px; }
.tracking-card { min-width: 0; padding: clamp(24px, 4vw, 38px); border: 1px solid rgba(213,222,232,.95); border-radius: 12px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.card-heading { margin-bottom: 26px; }
.card-heading h2 { margin: 0; font-size: 25px; }
.card-heading > p:not(.kicker) { margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.stack-form { display: grid; gap: 15px; }
.form-message { display: none; margin: 0; padding: 10px 12px; border: 1px solid #efc5bf; border-radius: 5px; color: var(--danger); background: #fff4f2; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.form-message.show { display: block; }
.form-message.success { color: var(--green); border-color: #b9dfd2; background: #f0faf6; }
.track-results { margin-top: 28px; }
.public-result + .public-result { margin-top: 18px; }
.public-result { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.public-result > header { padding: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; background: #f7f9fb; }
.public-result h3 { margin: 3px 0 0; font-size: 15px; }
.ticket-code { color: var(--blue); font-family: ui-monospace, Consolas, monospace; font-size: 11px; font-weight: 800; }
.result-meta { margin: 0; padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.result-meta .wide { grid-column: 1/-1; }
.result-meta dt { color: var(--muted); font-size: 10px; }
.result-meta dd { margin: 2px 0 0; font-size: 12px; font-weight: 700; overflow-wrap: anywhere; }
.public-timeline { padding: 0 16px 16px; }
.public-timeline h4 { margin: 0 0 10px; font-size: 12px; }
.public-timeline ol { margin: 0; padding: 0 0 0 14px; border-left: 1px solid #cad5e0; list-style: none; }
.public-timeline li { position: relative; padding: 0 0 14px 12px; }
.public-timeline li::before { content: ""; position: absolute; left: -18px; top: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); }
.public-timeline time { color: var(--muted); font-size: 10px; }
.public-timeline p { margin: 3px 0 0; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.site-footer { min-height: 62px; display: grid; place-items: center; color: #778397; font-size: 11px; }

.login-page { display: grid; place-items: center; padding: 20px; background: linear-gradient(145deg, #eaf0f5, #f6f8fa); }
.login-shell { width: min(420px, 100%); padding: clamp(28px, 6vw, 44px); border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.login-brand { margin-bottom: 44px; }
.login-heading h1 { margin: 0 0 28px; font-size: 27px; }
.login-bottom { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 11px; }

.admin-page { background: #f2f5f8; }
.admin-shell { width: min(1600px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 60px; }
.admin-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.admin-title h1 { margin: 0; font-size: clamp(28px, 3.2vw, 40px); letter-spacing: -.025em; }
.admin-title > div > p:last-child { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.admin-title-actions { display: flex; gap: 8px; }
.metrics { margin-top: 26px; display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.metrics button { min-width: 0; min-height: 82px; padding: 14px 16px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; border: 0; border-right: 1px solid var(--line); background: #fff; cursor: pointer; text-align: left; }
.metrics button:last-child { border-right: 0; }
.metrics button:hover { background: #f6f9fc; }
.metrics span { color: var(--muted); font-size: 10px; }
.metrics strong { margin-top: 4px; font-size: 24px; line-height: 1; }
.filters { margin-top: 16px; padding: 12px; display: grid; grid-template-columns: minmax(280px,1fr) 210px 210px; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.filters label { display: flex; align-items: center; gap: 10px; }
.filters label > span:not(.sr-only) { white-space: nowrap; }
.filters input, .filters select { margin: 0; }
.operations-grid { margin-top: 16px; display: grid; grid-template-columns: minmax(330px, 380px) minmax(0, 1fr); align-items: start; gap: 16px; }
.ticket-panel, .detail-panel { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.ticket-panel > header { min-height: 49px; padding: 0 15px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.ticket-panel > header > div { display: flex; align-items: center; gap: 7px; }
.ticket-panel > header strong { font-size: 12px; }
.ticket-panel > header span { color: var(--muted); font-size: 11px; }
.bulk-select-all { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.bulk-select-all input, .bulk-ticket-check input { width: 17px; height: 17px; margin: 0; accent-color: var(--navy); cursor: pointer; }
.bulk-select-all input:disabled, .bulk-ticket-check input:disabled { cursor: not-allowed; }
.bulk-toolbar { min-height: 50px; padding: 8px 10px 8px 14px; display: flex; align-items: center; gap: 6px; border-bottom: 1px solid #a9c9df; background: #eaf4fb; }
.bulk-toolbar strong { color: var(--navy); font-size: 15px; }
.bulk-toolbar span { color: #4f6077; font-size: 11px; font-weight: 750; }
.bulk-toolbar .button { margin-left: auto; }
.ticket-list { min-height: 340px; }
.ticket-row-wrap { display: grid; grid-template-columns: 42px minmax(0,1fr); border-bottom: 1px solid #e9edf2; background: #fff; }
.ticket-row-wrap:last-child { border-bottom: 0; }
.bulk-ticket-check { min-height: 100%; display: grid; place-items: center; border-right: 1px solid #edf0f3; background: #fafbfd; cursor: pointer; }
.bulk-ticket-check.disabled { background: #f5f6f8; opacity: .38; cursor: not-allowed; }
.ticket-row { width: 100%; min-height: 124px; padding: 14px 15px; display: block; border: 0; background: #fff; cursor: pointer; text-align: left; }
.ticket-row:hover { background: #f7f9fb; }
.ticket-row.active { box-shadow: inset 3px 0 0 var(--cyan); background: #eff8fa; }
.ticket-row-top, .ticket-row-main, .ticket-row-meta { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.ticket-row-top code { color: var(--blue); font-size: 10px; font-weight: 800; }
.ticket-row-top time { color: #8a96a8; font-size: 9px; }
.ticket-number-stack { min-width: 0; display: grid; gap: 2px; }
.ticket-number-stack code, .ticket-number-stack span { min-width: 0; overflow-wrap: anywhere; }
.ticket-number-stack span { color: #53647a; font-size: 9px; font-weight: 750; }
.ticket-row-main { margin-top: 8px; }
.ticket-row-main strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ticket-row-meta { margin-top: 6px; color: var(--muted); font-size: 10px; }
.ticket-row-meta span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-empty, .empty-state { min-height: 340px; padding: 28px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; color: var(--muted); text-align: center; }
.empty-state img { width: 150px; height: 120px; object-fit: contain; opacity: .55; }
.empty-state strong { font-size: 14px; }

.status-chip { max-width: 190px; padding: 4px 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #b9d5ef; border-radius: 999px; color: #165b91; background: #edf6fd; font-size: 9px; font-weight: 850; text-align: center; }
.status-repair_completed, .status-shipped, .status-closed { border-color: #b9dfd2; color: var(--green); background: #effaf5; }
.status-hold, .status-repair_impossible { border-color: #ead2ae; color: var(--amber); background: #fff8ec; }
.status-canceled { border-color: #efc5bf; color: var(--danger); background: #fff4f2; }
.detail-header { padding: 18px 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.detail-header h2 { margin: 3px 0 0; font-size: 21px; overflow-wrap: anywhere; }
.detail-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.detail-ticket-numbers { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-ticket-numbers span { padding: 2px 6px; border-radius: 4px; color: #315471; background: #eaf3f8; font-size: 10px; font-weight: 800; overflow-wrap: anywhere; }
.detail-header > div:last-child { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.detail-header small { color: var(--muted); font-size: 9px; }
.mobile-back { display: none; }
.detail-body { padding: 20px; }
.section-heading { min-height: 28px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-heading h3, .timeline-section > h3, .message-form h3 { margin: 0; font-size: 14px; }
.section-heading span { color: var(--muted); font-size: 10px; }
.section-heading.spaced { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.form-grid { display: grid; gap: 13px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid .span-all { grid-column: 1/-1; }
.form-grid .span-two { grid-column: span 2; }
.cost-fields > span:last-child { display: grid; grid-template-columns: 1fr 80px; gap: 6px; }
.align-right { margin-top: 15px; display: flex; justify-content: flex-end; }
.detail-edit-form .form-grid { margin-top: 11px; }
.action-box { margin: 24px 0; padding: 18px; display: grid; grid-template-columns: minmax(240px,1fr) minmax(220px,.8fr); gap: 16px; border: 1px solid #b9cde0; border-left: 4px solid var(--blue); border-radius: 8px; background: #f1f7fc; box-shadow: 0 6px 18px rgba(23,105,170,.06); }
.action-box label > span { color: var(--navy); font-size: 13px; font-weight: 850; }
.action-box textarea { min-height: 110px; border-color: #b9c9d8; font-size: 14px; line-height: 1.65; }
.action-inputs { min-width: 0; display: grid; gap: 13px; }
.action-buttons { display: flex; align-content: flex-start; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.timeline-section { margin-top: 30px; padding-top: 24px; border-top: 1px solid var(--line); }
.timeline-list { margin-top: 15px; display: grid; gap: 11px; }
.timeline-entry { position: relative; padding: 17px 18px; border: 1px solid var(--line); border-left: 4px solid #cbd5df; border-radius: 8px; background: #fff; }
.timeline-entry.reply-entry { margin-left: 30px; border-left: 3px solid #b9d5ef; }
.timeline-entry > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.timeline-entry > header > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.timeline-entry header strong { font-size: 13px; }
.timeline-entry header .message-kind { color: #4f6077; font-size: 11px; font-weight: 750; }
.timeline-entry time { color: #77869a; font-size: 10px; white-space: nowrap; }
.timeline-entry > p, .timeline-entry details p { margin: 11px 0 0; color: #263750; font-size: 15px; line-height: 1.68; white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-entry details { margin-top: 9px; color: var(--muted); font-size: 11px; }
.organization, .public-badge, .translation-badge, .translation-pending, .edited-badge { padding: 3px 6px; border-radius: 4px; font-size: 9px !important; font-weight: 850; }
.organization.spe { color: #175b9a; background: #eaf3fb; }
.organization.osaka { color: #067277; background: #e7f7f7; }
.public-badge { color: var(--green); background: #e8f7f0; }
.edited-badge { color: #675312; background: #fff3c4; }
.translation-badge, .translation-pending { margin-top: 8px; display: inline-block; color: #6457a8; background: #f0edff; }
.retry-translation, .reply-button, .edit-message-button, .delete-message-button { margin-top: 9px; padding: 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.reply-button { margin-left: 10px; }
.timeline-header-actions { display: flex; align-items: center; gap: 11px; }
.timeline-header-actions .edit-message-button, .timeline-header-actions .delete-message-button { margin-top: 0; }
.delete-message-button { color: var(--danger); }
.message-repair_instruction { border-color: #9ec3e5; border-left-color: var(--blue); background: #f3f8fd; box-shadow: 0 7px 20px rgba(23,105,170,.08); }
.message-return_instruction { border-color: #9fcdd2; border-left-color: var(--cyan); background: #f1fafa; box-shadow: 0 7px 20px rgba(24,168,187,.07); }
.message-repair_question { border-color: #e6c98f; border-left-color: #c07813; background: #fffaf0; }
.message-repair_answer { border-color: #add7dd; border-left-color: #148898; background: #f3fbfb; }
.message-repair_result { border-color: #acd8c8; border-left-color: var(--green); background: #f3faf7; }
.message-system_event { padding-top: 12px; padding-bottom: 12px; background: #f7f8fa; }
.attachment-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px,1fr)); gap: 10px; }
.attachment-card { min-width: 0; display: block; overflow: hidden; border: 1px solid #d5dde6; border-radius: 7px; background: #f7f9fb; transition: border-color .15s, transform .15s; }
.attachment-card:hover { border-color: #8ebada; transform: translateY(-1px); }
.attachment-card img { width: 100%; aspect-ratio: 4/3; display: block; object-fit: cover; background: #e9eef3; }
.attachment-caption { padding: 9px 10px; display: block; }
.attachment-caption > * { display: block; }
.attachment-card strong { margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.attachment-card small, .attachment-type { color: var(--muted); font-size: 9px; }
.attachment-file-icon { min-height: 115px; display: grid; place-items: center; color: #b42318; background: #fff1ef; font-size: 16px; font-weight: 900; }
.intake-gallery { margin-bottom: 26px; padding: 16px; border: 1px solid #bfd4e6; border-radius: 9px; background: #f5f9fd; }
.intake-gallery .attachment-grid { margin-top: 12px; }
.intake-gallery-heading > div:first-child { display: flex; align-items: center; gap: 8px; }
.intake-gallery-heading > div:first-child span { color: var(--muted); font-size: 10px; }
.intake-gallery-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; }
.intake-empty { margin: 12px 0 0; padding: 18px; border: 1px dashed #b9cbd9; border-radius: 7px; color: var(--muted); background: rgba(255,255,255,.65); font-size: 11px; text-align: center; }
.record-dates { margin: 0 0 24px; display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); border: 1px solid #d6e0e9; border-radius: 9px; background: #f8fafc; overflow: hidden; }
.record-dates > div { min-width: 0; padding: 13px 15px; display: grid; gap: 4px; }
.record-dates > div + div { border-left: 1px solid #d6e0e9; }
.record-dates span { color: var(--muted); font-size: 10px; font-weight: 750; }
.record-dates strong { color: var(--navy); font-size: 13px; overflow-wrap: anywhere; }
.message-form { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.message-form .form-grid { margin-top: 12px; }
.checkbox-label { display: flex; align-items: center; gap: 8px; }
.checkbox-label input { width: 18px; height: 18px; margin: 0; }
.audit-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.audit-section summary { cursor: pointer; color: var(--muted); font-size: 11px; font-weight: 800; }
.audit-section ol { margin: 12px 0 0; padding: 0; list-style: none; }
.audit-section li { padding: 10px 0; border-bottom: 1px solid #edf0f3; }
.audit-section li header { display: flex; justify-content: space-between; font-size: 9px; }
.audit-section pre { max-height: 140px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 9px; }

.modal { width: min(620px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 10px; background: transparent; overflow: visible; }
.modal.wide-modal { width: min(1040px, calc(100% - 28px)); }
.modal::backdrop { background: rgba(10,24,42,.58); backdrop-filter: blur(3px); }
.modal-card { max-height: calc(100vh - 28px); padding: 24px; border-radius: 10px; background: #fff; box-shadow: 0 24px 70px rgba(0,0,0,.22); overflow-y: auto; }
.modal-card > header { margin-bottom: 22px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-card h2 { margin: 0; font-size: 22px; }
.modal-card h3 { margin: 0; font-size: 14px; }
.modal-lead { margin: 5px 0 0; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.modal-card > footer { margin-top: 22px; display: flex; justify-content: flex-end; gap: 8px; }
.modal-card hr { margin: 24px 0; border: 0; border-top: 1px solid var(--line); }
.ai-intake { margin: -2px 0 20px; padding: 16px; border: 1px solid #bed8e9; border-radius: 8px; background: linear-gradient(135deg, #f0f8fc, #f5fbfa); }
.ai-intake-copy > span { color: var(--blue); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.ai-intake-copy h3 { margin-top: 3px; color: var(--navy); }
.ai-intake-copy p { margin: 5px 0 0; color: var(--muted); font-size: 11px; font-weight: 500; }
.ai-upload-row { margin-top: 13px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 9px; }
.ai-file-control > span, .field-label { display: block; color: #415068; font-size: 12px; font-weight: 760; }
.custom-file-row { min-height: 44px; margin-top: 7px; padding: 5px 9px 5px 5px; display: flex; align-items: center; gap: 10px; border: 1px solid #cfd7e2; border-radius: 6px; background: #fff; }
.custom-file-button { position: relative; flex: 0 0 auto; overflow: hidden; white-space: nowrap; }
.native-file-input { position: absolute !important; width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.file-selection-summary { min-width: 0; color: var(--muted); font-size: 10px; font-weight: 600; overflow-wrap: anywhere; }
.message-attachment-tools { min-width: 0; }
.file-drop-zone { margin-top: 7px; padding: 14px; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 10px 18px; border: 1px dashed #aabfce; border-radius: 8px; background: #f7fafc; transition: border-color .15s, background .15s, box-shadow .15s; }
.file-drop-zone:focus, .file-drop-zone.drag-over { border-color: var(--blue); background: #edf6fc; box-shadow: 0 0 0 3px rgba(23,105,170,.1); outline: 0; }
.file-drop-zone strong { display: block; color: var(--navy); font-size: 12px; }
.file-drop-zone > div:first-child span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.file-drop-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.file-drop-zone > .file-selection-summary { grid-column: 1/-1; }
.clipboard-paste { margin-top: 9px; padding: 9px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px dashed #b8cbd9; border-radius: 6px; background: rgba(255,255,255,.62); }
.clipboard-paste strong { display: block; color: #30445d; font-size: 10px; }
.clipboard-paste span { display: block; margin-top: 1px; color: var(--muted); font-size: 9px; font-weight: 500; }
.clipboard-paste .button { flex: 0 0 auto; white-space: nowrap; }
.ai-status { display: none; margin-top: 10px; padding: 9px 11px; border-radius: 5px; color: #536277; background: rgba(255,255,255,.72); font-size: 10px; overflow-wrap: anywhere; }
.ai-status.show { display: block; }
.ai-status.working { color: #175b9a; background: #e7f2fa; }
.ai-status.success { color: var(--green); background: #e9f8f1; }
.ai-status.warning { color: var(--amber); background: #fff6e8; }
.ai-status.error { color: var(--danger); background: #fff0ee; }
input.ai-filled { border-color: #61ad95; background: #f1fbf7; box-shadow: 0 0 0 2px rgba(8,122,85,.08); }
.file-preview-grid { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fill, minmax(125px, 1fr)); gap: 9px; }
.file-preview-item { min-width: 0; margin: 0; overflow: hidden; border: 1px solid #cbd9e4; border-radius: 7px; background: #fff; }
.file-preview-item img { width: 100%; aspect-ratio: 4/3; display: block; object-fit: cover; background: #e9eef3; }
.file-preview-item figcaption { padding: 7px 8px; overflow: hidden; color: #425269; font-size: 10px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.preview-file-type { min-height: 92px; display: grid; place-items: center; color: #b42318; background: #fff1ef; font-size: 15px; font-weight: 900; }
.edit-history-note { margin: 14px 0 0; padding: 10px 12px; border-radius: 6px; color: #55667c; background: #f3f6f9; font-size: 11px; line-height: 1.55; }
.international-fields { margin-top: 20px; padding: 16px; border: 1px solid #b9d5ef; border-radius: 8px; background: #f3f8fd; }
.international-fields .form-grid { margin-top: 10px; }
.bulk-shipment-bottom { margin-top: 18px; }
.confirm-destination { padding: 12px; border: 1px solid #c4d4df; border-radius: 7px; background: #f7fafc; color: var(--navy); }
.confirm-destination span { line-height: 1.5; }
.reanalyze-after-upload { margin-top: 16px; padding: 11px 12px; border-radius: 7px; background: #f3f8fd; color: var(--navy); }
.ai-compare-notice { margin: 0 0 15px; padding: 11px 13px; border-radius: 7px; color: #40536b; background: #f1f6fa; font-size: 11px; line-height: 1.6; }
.ai-compare-list { display: grid; gap: 9px; }
.ai-compare-row { padding: 12px; display: grid; grid-template-columns: minmax(145px,.75fr) minmax(0,1fr) minmax(0,1.2fr); align-items: end; gap: 10px; border: 1px solid #d9e1e9; border-radius: 7px; background: #fff; }
.ai-compare-row.same { opacity: .62; background: #f7f8fa; }
.ai-compare-check { min-height: 44px; display: flex; align-items: center; gap: 9px; color: var(--navy); }
.ai-compare-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--navy); }
.ai-compare-row > div > span, .ai-compare-row > label > span { display: block; color: var(--muted); font-size: 10px; }
.ai-compare-row > div strong { min-height: 44px; padding: 0 12px; display: flex; align-items: center; border: 1px solid #e0e5eb; border-radius: 6px; background: #f7f8fa; font-size: 12px; overflow-wrap: anywhere; }
.ai-compare-row input[data-ai-value] { margin-top: 7px; }
.ai-result-empty { padding: 28px 16px; border: 1px dashed #c7d1da; border-radius: 7px; color: var(--muted); text-align: center; }
.users-list { display: grid; gap: 7px; }
.users-list article { padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 6px; }
.users-list strong { display: block; font-size: 12px; }
.users-list span { display: block; margin-top: 2px; color: var(--muted); font-size: 9px; }
.toast { position: fixed; right: 20px; bottom: calc(20px + env(safe-area-inset-bottom)); z-index: 100; max-width: min(380px, calc(100% - 40px)); padding: 12px 15px; border: 1px solid #abd8c8; border-radius: 7px; color: var(--green); background: #effaf5; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .18s; font-size: 11px; font-weight: 800; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #efc5bf; color: var(--danger); background: #fff4f2; }

@media (max-width: 1120px) {
  .metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .metrics button:nth-child(3) { border-right: 0; }
  .metrics button:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
  .operations-grid { grid-template-columns: 330px minmax(0,1fr); }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid .span-two { grid-column: 1/-1; }
}

@media (max-width: 900px) {
  .public-shell { grid-template-columns: 1fr; width: min(680px, calc(100% - 32px)); padding-top: 36px; }
  .public-copy { text-align: center; }
  .public-copy > p { margin-left: auto !important; margin-right: auto !important; }
  .product-visual { width: min(300px, 72%); margin: 0 auto 26px; }
  .public-steps { text-align: left; }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-control { grid-column: 1/-1; }
  .operations-grid { grid-template-columns: 300px minmax(0,1fr); }
  .detail-body { padding: 16px; }
  .action-box { grid-template-columns: 1fr; }
  .action-buttons { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .public-header, .admin-header { min-height: 58px; padding: 8px 12px; }
  .brand img { width: 76px; }
  .brand span { padding-left: 9px; font-size: 8px; }
  .header-actions { gap: 3px; }
  .header-actions select { min-width: 76px; height: 36px; padding: 0 7px; font-size: 10px; }
  .header-actions .button { min-height: 36px; padding: 0 9px; font-size: 9px; }
  .public-shell { width: 100%; min-height: 0; padding: 28px 0 40px; gap: 30px; }
  .public-copy { padding: 0 18px; }
  .public-copy h1 { font-size: 32px; }
  .public-copy > p:not(.kicker) { font-size: 13px; }
  .product-visual { width: min(260px, 72vw); }
  .public-steps b { font-size: 10px; }
  .tracking-card { padding: 24px 18px; border-left: 0; border-right: 0; border-radius: 0; box-shadow: none; }
  .result-meta { grid-template-columns: 1fr; }
  .result-meta .wide { grid-column: auto; }

  .admin-shell { width: 100%; padding: 20px 0 40px; }
  .admin-title { padding: 0 14px; align-items: flex-start; }
  .admin-title h1 { font-size: 25px; }
  .admin-title-actions { flex-direction: column-reverse; align-items: stretch; }
  .admin-title-actions .button { min-height: 38px; padding: 0 10px; font-size: 10px; }
  .metrics { margin-top: 18px; grid-template-columns: repeat(2, minmax(0,1fr)); border-left: 0; border-right: 0; border-radius: 0; }
  .metrics button { min-height: 68px; border-bottom: 1px solid var(--line); }
  .metrics button:nth-child(odd) { border-right: 1px solid var(--line); }
  .metrics button:nth-child(even) { border-right: 0; }
  .metrics button:nth-last-child(-n+2) { border-bottom: 0; }
  .metrics strong { font-size: 20px; }
  .filters { margin-top: 12px; padding: 10px 14px; grid-template-columns: 1fr; border-left: 0; border-right: 0; border-radius: 0; }
  .search-control { grid-column: auto; }
  .operations-grid { margin-top: 12px; display: block; }
  .ticket-panel, .detail-panel { border-left: 0; border-right: 0; border-radius: 0; }
  .detail-panel { display: none; }
  .operations-grid.show-detail .ticket-panel { display: none; }
  .operations-grid.show-detail .detail-panel { display: block; }
  .ticket-row { min-height: 116px; }
  .ticket-panel > header { position: sticky; top: 58px; z-index: 8; background: #fff; }
  .bulk-toolbar { position: sticky; top: 107px; z-index: 7; box-shadow: 0 7px 13px rgba(11,36,71,.08); }
  .ticket-row-wrap { grid-template-columns: 40px minmax(0,1fr); }
  .detail-header { padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
  .detail-header > div:nth-child(2) { grid-column: 1/-1; grid-row: 2; }
  .mobile-back { grid-column: 1; display: inline-flex; width: max-content; padding: 0; border: 0; color: var(--blue); background: transparent; cursor: pointer; font-size: 10px; font-weight: 800; }
  .detail-header > div:last-child { grid-column: 2; grid-row: 1; }
  .detail-body { padding: 15px 14px; }
  .form-grid.three { grid-template-columns: 1fr; }
  .form-grid.two { grid-template-columns: 1fr; }
  .form-grid .span-all, .form-grid .span-two { grid-column: auto; }
  .action-box { padding: 13px; }
  .action-buttons .button { flex: 1 1 calc(50% - 7px); min-width: 125px; }
  .timeline-entry > header { display: block; }
  .timeline-entry time { display: block; margin-top: 5px; }
  .timeline-entry.reply-entry { margin-left: 14px; }
  .attachment-grid, .file-preview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .modal, .modal.wide-modal { width: 100%; max-width: none; max-height: 100vh; margin: 0; }
  .modal-card { min-height: 100vh; max-height: 100vh; padding: 20px 15px calc(24px + env(safe-area-inset-bottom)); border-radius: 0; }
  .ai-intake { margin-left: -3px; margin-right: -3px; padding: 14px; }
  .ai-upload-row { grid-template-columns: 1fr; }
  .ai-upload-row .button { width: 100%; }
  .file-drop-zone { grid-template-columns: 1fr; }
  .file-drop-actions { justify-content: stretch; }
  .file-drop-actions .button { flex: 1 1 0; }
  .file-drop-zone > .file-selection-summary { grid-column: auto; }
  .clipboard-paste { align-items: stretch; flex-direction: column; }
  .clipboard-paste .button { width: 100%; }
  .intake-gallery-heading { align-items: flex-start; flex-direction: column; }
  .intake-gallery-actions { width: 100%; justify-content: stretch; }
  .intake-gallery-actions .button { flex: 1 1 0; }
  .ai-compare-row { grid-template-columns: 1fr; align-items: stretch; }
}

@media (max-width: 430px) {
  .brand span { display: none; }
  .admin-header { flex-wrap: wrap; }
  .admin-header .brand { flex: 1 1 auto; }
  .admin-header .header-actions { width: 100%; justify-content: stretch; }
  .admin-header .header-actions > * { flex: 1 1 auto; }
  .public-steps { grid-template-columns: repeat(2, 1fr); gap: 10px 0; }
  .public-result > header { display: block; }
  .public-result .status-chip { margin-top: 10px; }
  .attachment-grid, .file-preview-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
/* Simple four-step workflow: the page scrolls; only open dialogs have their own viewport. */
body:has(dialog[open]) { overflow: hidden; }
[hidden] { display:none !important; }
#work-confirm-dialog { max-width:560px; }
#work-confirm-ticket,#work-confirm-description { overflow-wrap:anywhere; white-space:pre-wrap; line-height:1.7; }
#work-confirm-ticket { font-weight:700; }
.workflow-steps { list-style:none; padding:0; margin:0 0 20px; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
.workflow-steps li { background:#f0f3f6; border-radius:10px; padding:12px 8px; text-align:center; color:#536170; font-size:14px; font-weight:650; overflow-wrap:anywhere; }
.workflow-steps li span { display:block; margin-bottom:4px; }
.workflow-steps .current { background:#123b60; color:white; }
.workflow-steps .done { background:#e4f2ea; color:#21623c; }
.latest-instruction,.shipment-summary { border:1px solid #b9cddd; border-left:4px solid #24587e; background:#f5f9fc; border-radius:10px; padding:16px; margin:16px 0; }
.latest-instruction p,.shipment-summary p { white-space:pre-wrap; overflow-wrap:anywhere; font-size:17px; line-height:1.8; margin:8px 0 0; }
.action-box { display:block; }
.action-box h3 { margin:0; }
.action-box .section-heading { flex-wrap:wrap; gap:12px; }
.action-box textarea { min-height:80px; margin-top:10px; font-size:16px; }
.action-box summary { cursor:pointer; font-size:14px; }
.workflow-hint,.quick-intake-hint { font-size:14px; line-height:1.6; color:#536170; }
.exception-actions { margin-top:14px; }
.exception-actions summary,.detail-editor-section>summary,.intake-optional>summary { cursor:pointer; padding:14px 0; font-size:15px; font-weight:650; }
.detail-editor-section { border-block:1px solid #dce4eb; margin:20px 0; }
.intake-optional { width:100%; }
.list-pagination { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px; border-top:1px solid #dce4eb; }
.list-pagination span { white-space:nowrap; font-size:13px; }
.custom-file-row { flex-wrap:wrap; }
.custom-file-row .custom-file-button { width:auto; }
.custom-file-row .file-selection-summary { flex:1 1 150px; }
@media(max-width:760px) {
  .workflow-steps { gap:4px; }
  .workflow-steps li { padding:10px 4px; font-size:12px; }
  .custom-file-row .custom-file-button { width:auto !important; }
  .custom-file-row .file-selection-summary { flex-basis:160px; }
  .latest-instruction p { font-size:16px; }
  .admin-page input,.admin-page textarea,.admin-page select { font-size:16px; }
}
