/* Cutescape Studio — staff order notebook. Same cream / mint / peach palette as the other staff pages. */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: #F9F4EE; color: #2E2522; font: 15px/1.55 "Noto Sans Thai", "Sarabun", Arial, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
.o-layout { max-width: 1080px; margin: 0 auto; padding: 20px 16px 90px; }
[hidden] { display: none !important; }

.o-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding-bottom: 16px; border-bottom: 1.5px solid #EADBCE; margin-bottom: 16px; }
.o-header h1 { margin: 6px 0 0; font-size: clamp(20px, 3vw, 27px); }
.o-badge { display: inline-block; padding: 3px 10px; background: #D8F4E8; color: #16866F; border-radius: 999px; font-size: 12px; font-weight: 700; }
.o-nav { display: flex; gap: 8px; flex-wrap: wrap; }

.o-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid #A8C5B5; background: #FFFDF9; color: #2E2522; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; }
.o-btn:hover:not(:disabled) { background: #D8F4E8; color: #16866F; }
.o-btn:disabled { opacity: .55; cursor: not-allowed; }
.o-btn-primary { background: #16866F; border-color: #16866F; color: #fff; }
.o-btn-primary:hover:not(:disabled) { background: #0E5E4D; color: #fff; }
.o-btn-danger { border-color: #E3A398; color: #C0392B; }
.o-btn-danger:hover:not(:disabled) { background: #FDF0ED; color: #C0392B; }
.o-btn-ghost { background: transparent; }
.o-btn-sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }

.o-statusbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.o-sync { display: flex; align-items: center; gap: 10px; }
.o-pill { margin: 0; padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.o-pill-wait { background: #FFF8EE; color: #8A6D3B; border: 1px solid #F5E6CC; }
.o-pill-ok { background: #EDF5F0; color: #16866F; border: 1px solid #A8C5B5; }
.o-pill-err { background: #FDF0ED; color: #C0392B; border: 1px solid #F5B7B1; }
.o-muted { color: #7A6F68; font-size: 13px; }
.o-alert { margin: 0 0 12px; padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; position: sticky; top: 8px; z-index: 40; }
.o-alert:empty { display: none; }
.o-alert[data-error="false"] { background: #EDF5F0; color: #16866F; border: 1.5px solid #A8C5B5; }
.o-alert[data-error="true"] { background: #FDF0ED; color: #C0392B; border: 1.5px solid #F5B7B1; }

.o-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.o-tab { flex: 1; min-height: 44px; border: 1.5px solid #EADBCE; border-radius: 14px; background: #FFFDF9; font: inherit; font-weight: 700; color: #7A6F68; cursor: pointer; }
.o-tab[aria-selected="true"] { background: #D8F4E8; border-color: #A8C5B5; color: #16866F; }
.o-count { display: inline-block; min-width: 22px; padding: 0 7px; border-radius: 999px; background: #fff; font-size: 12px; }

.o-toolbar { display: grid; grid-template-columns: 2fr repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 14px; }
input:not([type="file"]):not([type="checkbox"]), select, textarea { width: 100%; padding: 9px 12px; border: 1.5px solid #EADBCE; border-radius: 12px; background: #FFFDF9; color: #2E2522; font: inherit; font-size: 15px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, .o-btn:focus-visible, .o-tab:focus-visible, .o-card:focus-visible { outline: 3px solid #A8C5B5; outline-offset: 1px; }

.o-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.o-card { display: block; width: 100%; text-align: left; padding: 14px 16px; border: 1.5px solid #EADBCE; border-radius: 16px; background: #FFFDF9; font: inherit; color: inherit; cursor: pointer; box-shadow: 0 2px 8px rgba(46, 37, 34, .05); }
.o-card:hover { border-color: #A8C5B5; }
.o-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.o-card-no { font-size: 12px; font-weight: 700; color: #7A6F68; }
.o-card-name { font-size: 17px; font-weight: 700; margin: 2px 0; overflow-wrap: anywhere; }
.o-card-desc { margin: 0 0 8px; color: #4A3E39; font-size: 14px; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.o-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.o-chip { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #F3EBE2; color: #5B4F49; }
.o-chip-prod { background: #E3EEF9; color: #2B5C8A; }
.o-chip-prod[data-s="queued"], .o-chip-prod[data-s="received"], .o-chip-prod[data-s="awaiting-item"] { background: #FFF1D6; color: #8A5A00; }
.o-chip-prod[data-s="in-production"] { background: #E3EEF9; color: #2B5C8A; }
.o-chip-prod[data-s="finished"], .o-chip-prod[data-s="item-received"] { background: #D8F4E8; color: #16866F; }
.o-chip-prod[data-s="closed"] { background: #ECE7E2; color: #5B4F49; }
.o-chip-pay[data-s="unpaid"] { background: #FDE5E1; color: #B03A2E; }
.o-chip-pay[data-s="deposit"] { background: #FFF1D6; color: #8A5A00; }
.o-chip-pay[data-s="paid"] { background: #D8F4E8; color: #16866F; }
.o-card-meta { margin-top: 8px; display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: #7A6F68; flex-wrap: wrap; }
.o-empty { text-align: center; color: #7A6F68; padding: 36px 12px; background: #FFFDF9; border: 1.5px dashed #EADBCE; border-radius: 16px; }
.o-more { text-align: center; margin-top: 14px; }

.o-dialog { width: min(760px, 100vw - 16px); max-height: calc(100dvh - 16px); padding: 0; border: 1.5px solid #EADBCE; border-radius: 20px; background: #FFFDF9; color: #2E2522; overflow: hidden; }
.o-dialog[open] { display: flex; flex-direction: column; }
.o-dialog::backdrop { background: rgba(46, 37, 34, .45); }
.o-dialog form { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 16px); }
.o-dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid #EADBCE; background: #FFF8EE; flex: none; }
.o-dialog-bar h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.o-x { width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent; font-size: 26px; line-height: 1; cursor: pointer; color: #5B4F49; }
.o-dialog-body { padding: 16px 18px; overflow-y: auto; flex: 1; min-height: 0; }
.o-dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #EADBCE; background: #FFF8EE; flex: none; }

.o-fieldset { margin: 0 0 14px; padding: 12px 14px 14px; border: 1.5px solid #EADBCE; border-radius: 14px; }
.o-fieldset legend { padding: 0 8px; font-weight: 700; color: #16866F; }
.o-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.o-span2 { grid-column: 1 / -1; }
.o-field { display: block; font-size: 13px; font-weight: 700; color: #4A3E39; }
.o-field > input, .o-field > select, .o-field > textarea { margin-top: 5px; font-weight: 400; }
.o-req { color: #C0392B; }
.o-form-error { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: #FDF0ED; color: #C0392B; border: 1.5px solid #F5B7B1; font-weight: 600; }

.o-section { margin: 0 0 16px; }
.o-section h3 { margin: 0 0 8px; font-size: 15px; color: #16866F; }
.o-kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.o-kv dt { color: #7A6F68; }
.o-kv dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.o-status-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.o-link { color: #16866F; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.o-thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.o-thumb { width: 104px; }
.o-thumb img { width: 104px; height: 104px; object-fit: cover; border-radius: 12px; border: 1.5px solid #EADBCE; background: #F3EBE2; display: block; cursor: zoom-in; }
.o-thumb button { margin-top: 4px; width: 100%; }
.o-history { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.o-history li { padding: 5px 0; border-bottom: 1px dashed #EADBCE; display: flex; gap: 10px; }
.o-history time { color: #7A6F68; flex: none; width: 128px; }
.o-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.o-closed-note { padding: 10px 14px; border-radius: 12px; background: #ECE7E2; font-weight: 600; margin-bottom: 14px; }
.o-photo-dialog img { max-width: 100%; max-height: 80dvh; display: block; margin: 0 auto; }

@media (max-width: 760px) {
  .o-toolbar { grid-template-columns: 1fr 1fr; }
  .o-toolbar #search { grid-column: 1 / -1; }
  .o-list { grid-template-columns: 1fr; }
  .o-grid, .o-status-row { grid-template-columns: 1fr; }
  .o-kv { grid-template-columns: 110px 1fr; }
  .o-dialog { width: 100vw; max-height: 100dvh; border-radius: 0; border-width: 0; }
  .o-dialog form { max-height: 100dvh; }
  .o-history li { flex-direction: column; gap: 0; }
  .o-history time { width: auto; }
}

/* Shop Mode PIN gate and lock bar (rendered by shop-access.js; same look as the Studio). */
.shop-gate { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 16px; background: rgba(40, 34, 28, .72); }
.shop-gate-card { width: min(380px, 100%); padding: 22px 20px; border-radius: 18px; background: #fffaf0; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); text-align: center; display: grid; gap: 12px; }
.shop-gate-card h2 { margin: 0; }
.shop-gate-card p { margin: 0; line-height: 1.5; }
.shop-gate-form { display: grid; gap: 8px; }
.shop-gate-pin { font-size: 24px; letter-spacing: 8px; text-align: center; padding: 8px; border-radius: 10px; border: 2px solid #c8ab60; }
.shop-gate-submit { min-height: 44px; border: 0; border-radius: 12px; background: #3f3a34; color: #fff; font-weight: 700; cursor: pointer; font: inherit; }
.shop-gate-error { color: #9a2f22; min-height: 1.2em; }
.shop-gate-uid { display: block; padding: 8px; border-radius: 8px; background: #fff; font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.shop-gate-customer { font-size: 14px; color: #7A6F68; }
.shop-lock-bar { position: fixed; left: 12px; bottom: 12px; z-index: 9999; display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-radius: 999px; background: #3f3a34; color: #fff; font-size: 13px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.shop-lock-button { border: 0; border-radius: 999px; padding: 6px 12px; background: #fff; color: #3f3a34; font-weight: 700; cursor: pointer; font: inherit; font-size: 13px; }
