:root {
  color-scheme: light;
  --navy: #102a39;
  --ink: #182d39;
  --muted: #687b86;
  --line: #dfe8e9;
  --paper: #f5f8f7;
  --white: #fff;
  --teal: #007e77;
  --teal-dark: #00645e;
  --teal-soft: #e4f4f0;
  --amber: #a66b15;
  --amber-soft: #fff2dc;
  --red: #a93c45;
  --red-soft: #ffebed;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-size: 14px; }
button, input, select, dialog { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #66c5b6; outline-offset: 3px; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 228px; flex: 0 0 228px; background: var(--navy); color: #d9e8e8; padding: 30px 18px 22px; display: flex; flex-direction: column; min-height: 100vh; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 0 10px; }
.brand-mark { display: grid; place-items: center; width: 39px; height: 39px; flex: 0 0 39px; border-radius: 12px; background: #54d2bc; color: #113e44; font-size: 14px; font-weight: 800; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 17px; letter-spacing: -.025em; line-height: 1.15; }
.brand small { font-size: 10px; color: #91abb2; margin-top: 4px; letter-spacing: .07em; }
.side-nav { margin-top: 56px; display: grid; gap: 6px; }
.nav-link { color: #abc3c8; text-decoration: none; padding: 12px 14px; border-radius: 10px; font-weight: 600; transition: background .15s, color .15s; }
.nav-link:hover, .nav-link.active { color: #fff; background: #224353; }
.sidebar-note { margin-top: auto; border-top: 1px solid #35515d; padding: 18px 10px 0; color: #8faab1; font-size: 11px; line-height: 1.5; }
.main-content { width: min(100%, 1480px); min-width: 0; margin: 0 auto; padding: 35px clamp(24px, 4vw, 60px) 70px; }
.page-header, .section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.page-header { margin-bottom: 34px; align-items: center; }
.eyebrow { margin: 0 0 9px; color: var(--teal); font-size: 10px; letter-spacing: .17em; font-weight: 800; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(27px, 3vw, 36px); letter-spacing: -.04em; line-height: 1.18; }
h2 { margin-bottom: 0; font-size: 21px; letter-spacing: -.03em; }
.page-subtitle, .section-description { color: var(--muted); line-height: 1.6; }
.page-subtitle { margin-bottom: 0; }
.header-actions, .section-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.connection-badge { border-radius: 99px; background: var(--teal-soft); color: var(--teal-dark); padding: 8px 12px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.connection-badge.muted { background: #e9eeee; color: #61747d; }
.connection-badge.warning { background: var(--amber-soft); color: var(--amber); }
.button { display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid transparent; min-height: 38px; padding: 9px 14px; font-weight: 700; font-size: 12px; white-space: nowrap; transition: background .15s, border-color .15s, transform .15s; }
.button:not(:disabled):active { transform: translateY(1px); }
.button-primary { background: var(--teal); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--teal-dark); }
.button-quiet { background: #fff; color: #3b5662; border-color: var(--line); }
.button-quiet:hover:not(:disabled) { background: #edf5f4; border-color: #bed4d1; }
.button-danger { background: #fff; color: var(--red); border-color: #efd1d4; }
.button-danger:hover:not(:disabled) { background: var(--red-soft); }
.button-small { padding: 7px 10px; min-height: 32px; font-size: 11px; }
.login-panel { display: grid; grid-template-columns: 54px minmax(200px, 1fr) minmax(260px, 340px); gap: 24px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 17px; padding: 30px; box-shadow: 0 9px 36px #1434420a; }
.login-icon { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 16px; background: var(--teal-soft); color: var(--teal); font-size: 30px; }
.login-copy h2 { font-size: 24px; margin-bottom: 10px; }
.login-copy p:last-child { color: var(--muted); line-height: 1.65; margin-bottom: 0; }
.login-form { display: grid; gap: 9px; }
.login-form label { font-weight: 700; font-size: 12px; }
.login-form input { width: 100%; border: 1px solid #cddcde; border-radius: 9px; padding: 11px 12px; outline: none; background: #fbfdfc; }
.login-form input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #57bdb32a; }
.form-error { color: var(--red); font-size: 12px; margin: 0; }
.section-block { scroll-margin-top: 24px; margin-bottom: 30px; }
.section-heading { margin-bottom: 17px; }
.section-heading.compact { align-items: center; }
.section-meta { color: #81929b; font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.metric-card, .card-panel { background: #fff; border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 4px 20px #0d344508; }
.metric-card { padding: 21px 21px 20px; min-height: 127px; display: flex; flex-direction: column; }
.metric-label { color: #687d87; font-size: 12px; font-weight: 600; }
.metric-card strong { font-size: 23px; letter-spacing: -.04em; margin-top: 15px; }
.metric-card small { display: block; margin-top: 7px; color: #8a9ba3; font-size: 11px; line-height: 1.4; }
.raw-state { margin-top: 14px; background: #edf3f2; border: 1px solid #e2ebea; border-radius: 10px; }
.raw-state summary { cursor: pointer; padding: 11px 15px; color: #506872; font-weight: 700; font-size: 12px; }
.raw-state pre { margin: 0; padding: 0 15px 15px; overflow: auto; color: #38515c; font-size: 11px; line-height: 1.5; }
.data-hint { color: #899aa2; font-size: 11px; margin: 11px 2px 0; }
.two-column { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, .9fr); gap: 18px; }
.card-panel { padding: 25px; }
.section-description { margin-bottom: 19px; font-size: 12px; }
.upload-area { display: flex; align-items: center; justify-content: center; cursor: pointer; width: 100%; min-height: 190px; background: #f8fbfa; border: 1.5px dashed #b8d1d0; border-radius: 12px; text-align: center; overflow: hidden; }
.upload-area:hover { border-color: var(--teal); background: #f2faf8; }
.upload-prompt { display: grid; justify-items: center; gap: 7px; padding: 20px; }
.upload-prompt strong { font-size: 13px; }
.upload-prompt small { color: #8a9da4; font-size: 11px; }
.upload-symbol { width: 36px; height: 36px; border-radius: 11px; background: var(--teal-soft); color: var(--teal); font-size: 26px; line-height: 32px; }
.preview-wrap { width: 100%; height: 260px; min-width: 0; display: block; padding: 8px; }
.preview-wrap img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.print-crop-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.settings-form { display: flex; gap: 18px; flex-wrap: wrap; align-items: flex-end; }
.settings-form label { display: grid; gap: 8px; font-size: 13px; font-weight: 700; }
.settings-form select { min-width: 165px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.almanac-form, .almanac-preview-controls { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 13px; }
.almanac-form label, .almanac-preview-controls label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 700; }
.almanac-form .almanac-toggle { display: flex; align-items: center; gap: 8px; min-height: 38px; }
.almanac-form select, .almanac-preview-controls input { min-height: 38px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.almanac-form select { min-width: 180px; }
.almanac-preview-controls { margin-top: 23px; }
.almanac-preview { display: grid; grid-template-columns: repeat(2, minmax(0, 220px)) minmax(230px, 1fr); gap: 16px; margin-top: 17px; }
.almanac-preview figure { margin: 0; min-width: 0; }
.almanac-preview figcaption { color: var(--muted); font-size: 11px; font-weight: 700; margin-bottom: 7px; }
.almanac-image-button { display: block; width: 100%; border: 0; padding: 0; background: transparent; text-align: left; cursor: pointer; }
.almanac-image-button:disabled { cursor: default; }
.almanac-image-button:not(:disabled):focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; border-radius: 8px; }
.almanac-preview img { display: block; width: 100%; max-height: 330px; object-fit: contain; background: #edf2f2; border-radius: 8px; }
.almanac-content { font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.almanac-content strong { display: block; margin-bottom: 8px; }
.almanac-content p { margin-bottom: 7px; }
.almanac-content .button { margin: 8px 0; }
.almanac-content small { display: block; color: var(--muted); }
.almanac-history-title { margin: 25px 0 10px; font-size: 14px; }
.almanac-history { display: grid; gap: 7px; color: var(--muted); font-size: 12px; }
.almanac-history-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; border-top: 1px solid var(--line); padding: 9px 0; }
.almanac-history-row strong { color: var(--ink); }
.almanac-history-row small { width: 100%; color: var(--muted); }
@media (max-width: 1050px) { .almanac-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); } .almanac-content { grid-column: 1 / -1; } }
@media (max-width: 600px) { .almanac-preview { grid-template-columns: minmax(0, 1fr); } .almanac-content { grid-column: auto; } }
.image-preview-dialog { width: min(900px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; border: 1px solid var(--line); border-radius: 15px; padding: 24px; }
.image-preview-dialog::backdrop { background: #102a3999; }
.preview-comparison { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 20px; }
.preview-comparison figure { margin: 0; min-width: 0; }
.preview-comparison figcaption { text-align: center; font-weight: 700; font-size: 13px; margin-bottom: 9px; }
.preview-comparison img { width: 100%; height: min(55vh, 460px); object-fit: contain; background: #edf2f2; border-radius: 8px; }
.crop-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.crop-toolbar [aria-pressed="true"] { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); }
#cropStage { height: min(50dvh, 460px); min-height: 240px; display: block; padding: 0; background: #edf2f2; }
#cropSourceImage { display: block; max-width: 100%; }
.cropper-point { width: 10px; height: 10px; opacity: .9; }
@media (max-width: 600px) { .image-preview-dialog { padding: 18px; } .preview-comparison { gap: 9px; } .preview-comparison img { height: 36vh; } .crop-dialog { padding: 18px; } }
.form-footer { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-top: 14px; }
.selected-file { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workflow-list { list-style: none; padding: 0; margin: 0; }
.workflow-list li { display: flex; gap: 16px; padding: 13px 0; border-bottom: 1px solid #ebf0f0; }
.workflow-list li:first-child { padding-top: 0; }
.workflow-list li:last-child { border-bottom: 0; }
.workflow-list li > span { color: var(--teal); font-size: 12px; font-weight: 800; letter-spacing: .04em; padding-top: 2px; }
.workflow-list strong { display: block; font-size: 12px; }
.workflow-list p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.inline-note { background: var(--amber-soft); color: #8b681e; border-radius: 9px; font-size: 11px; line-height: 1.6; margin: 14px 0 0; padding: 11px 13px; }
.table-scroll { overflow-x: auto; }
.jobs-table { border-collapse: collapse; width: 100%; min-width: 650px; text-align: left; }
.jobs-table th { color: #81939d; font-size: 10px; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; padding: 9px 10px 12px; border-bottom: 1px solid var(--line); }
.jobs-table td { padding: 14px 10px; border-bottom: 1px solid #eef2f2; font-size: 12px; vertical-align: middle; }
.jobs-table tr:last-child td { border-bottom: 0; }
.jobs-table td:nth-child(3) { color: #627781; }
.empty-cell { text-align: center; color: #98a9af; padding: 28px !important; }
.status-pill { display: inline-block; border-radius: 99px; padding: 5px 9px; font-size: 10px; font-weight: 800; background: #edf2f2; color: #677a82; white-space: nowrap; }
.status-pill.succeeded { background: var(--teal-soft); color: var(--teal-dark); }
.status-pill.failed { background: var(--red-soft); color: var(--red); }
.status-pill.leased { background: var(--amber-soft); color: var(--amber); }
.job-id { border: 0; background: transparent; color: #467e87; padding: 3px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.job-id:hover { text-decoration: underline; }
.slots-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.slot-card { border: 1px solid #e3ebeb; border-radius: 11px; background: #fbfdfc; padding: 15px; min-height: 155px; display: flex; flex-direction: column; }
.slot-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.slot-number { color: var(--teal); font-size: 11px; font-weight: 800; }
.slot-position { color: #8b9da5; font-size: 10px; }
.slot-image-id { overflow-wrap: anywhere; font-size: 12px; font-weight: 700; margin-top: 24px; line-height: 1.35; }
.slot-image-id.empty { color: #a2b0b5; font-weight: 500; }
.slot-photo { width: 100%; height: 140px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 5px; margin-top: 12px; background: #eef3f2; color: var(--muted); font-size: 11px; overflow: hidden; }
.slot-photo img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.slot-photo + .slot-image-id { margin-top: 10px; }
.slot-actions { margin-top: auto; padding-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.slot-actions .button { min-height: 29px; padding: 5px 8px; }
.empty-state { grid-column: 1 / -1; border-radius: 11px; background: #f7faf9; color: #8c9da4; text-align: center; padding: 28px; font-size: 12px; }
.gateway-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.gateway-picker label { font-weight: 700; font-size: 12px; }
.gateway-picker select { min-width: min(100%, 340px); padding: 9px 12px; border: 1px solid #cddcde; border-radius: 9px; color: var(--ink); background: #fbfdfc; }
.rename-dialog { width: min(420px, calc(100vw - 32px)); max-width: none; border: 1px solid var(--line); border-radius: 15px; padding: 24px; color: var(--ink); background: #fff; box-shadow: 0 20px 60px #102a3940; }
.rename-dialog::backdrop { background: #102a3999; }
.crop-dialog, .photo-dialog { width: min(740px, calc(100vw - 24px)); max-width: none; max-height: calc(100vh - 24px); overflow: auto; border: 1px solid var(--line); border-radius: 15px; padding: 22px; color: var(--ink); background: #fff; box-shadow: 0 20px 60px #102a3940; }
.crop-dialog::backdrop, .photo-dialog::backdrop { background: #102a3999; }
.crop-dialog h2 { margin-bottom: 12px; }
.crop-stage { display: flex; justify-content: center; background: #e9eeee; padding: 8px; border-radius: 10px; }
.crop-stage canvas { display: block; max-width: 100%; max-height: 50vh; width: auto; height: auto; touch-action: none; cursor: grab; border: 2px solid var(--teal); }
.crop-stage canvas:active { cursor: grabbing; }
.crop-zoom { display: flex; gap: 15px; align-items: center; margin: 18px 0; }
.crop-zoom input { flex: 1; min-width: 0; }
.photo-dialog > img { display: block; width: 100%; height: min(65vh, 700px); object-fit: contain; }
.rename-dialog-form { display: grid; gap: 14px; }
.rename-dialog-form h2 { margin-bottom: 3px; }
.rename-dialog-form label { font-weight: 700; font-size: 12px; }
.rename-dialog-form input { width: 100%; padding: 11px 12px; border: 1px solid #cddcde; border-radius: 9px; color: var(--ink); background: #fbfdfc; }
.rename-dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 5px; }
.gateway-panel > .section-meta { display: block; margin: 15px 0 0; overflow-wrap: anywhere; }
.binding-code { display: flex; align-items: baseline; gap: 13px; flex-wrap: wrap; margin-top: 15px; padding: 13px 16px; background: var(--teal-soft); border-radius: 10px; }
.binding-code span, .binding-code small { color: var(--teal-dark); font-size: 12px; }
.binding-code strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; font-size: 19px; }
.toast { position: fixed; right: 24px; bottom: 24px; max-width: min(410px, calc(100vw - 48px)); background: var(--navy); color: #fff; border-radius: 10px; box-shadow: 0 14px 38px #102a3935; padding: 13px 16px; z-index: 10; font-size: 12px; line-height: 1.5; }
.toast.error { background: #8d3139; }
@media (max-width: 1150px) { .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .slots-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 850px) { .sidebar { width: 78px; flex-basis: 78px; align-items: center; padding: 22px 8px; } .brand { padding: 0; } .brand strong, .brand small, .sidebar-note { display: none; } .side-nav { width: 100%; margin-top: 44px; } .nav-link { text-align: center; padding: 11px 4px; font-size: 10px; } .two-column { grid-template-columns: 1fr; } .slots-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .login-panel { grid-template-columns: 45px 1fr; } .login-form { grid-column: 1 / -1; } }
@media (max-width: 600px) { .app-shell { display: block; } .sidebar { position: static; width: 100%; height: auto; min-height: 0; flex-direction: row; padding: 12px 16px; align-items: center; gap: 18px; } .brand-mark { width: 34px; height: 34px; flex-basis: 34px; border-radius: 9px; } .side-nav { margin: 0; display: flex; gap: 2px; overflow-x: auto; } .nav-link { white-space: nowrap; padding: 8px 7px; } .main-content { padding: 23px 17px 45px; } .page-header { align-items: flex-start; gap: 16px; } .header-actions { justify-content: flex-end; } .header-actions .button { min-height: 31px; padding: 5px 8px; } .connection-badge { padding: 7px 9px; } .metric-grid { gap: 9px; } .metric-card { padding: 16px; min-height: 118px; } .metric-card strong { font-size: 20px; } .card-panel { padding: 19px 16px; } .slots-grid { gap: 9px; } .slot-card { padding: 12px; } .section-heading { align-items: flex-start; } .section-actions { justify-content: flex-end; } .login-panel { padding: 19px; gap: 12px; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }
