:root {
  --brand: #f47b20;
  --brand-2: #ff9a45;
  --brand-dark: #d9650f;
  --brand-weak: #fff3e8;
  --text: #1f2633;
  --text-2: #4b5563;
  --muted: #8a919c;
  --line: #e7e9ee;
  --bg: #f5f6f8;
  --card: #ffffff;
  --field: #ffffff;
  --in: #15a34a;
  --in-bg: #e7f7ee;
  --out: #2563eb;
  --out-bg: #e8f0fe;
  --danger: #e5484d;
  --danger-dark: #cc3338;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 16px rgba(17, 24, 39, .05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .01em; word-break: break-all; }
.muted { color: var(--muted); }

/* ---------- icons ---------- */
.ic { width: 22px; height: 22px; flex: none; }
.ic-xs { width: 14px; height: 14px; }
.ic-sm { width: 17px; height: 17px; }
.ic-lg { width: 28px; height: 28px; }
.logo { color: var(--brand); }
.logo-sm { width: 40px; height: 40px; color: var(--text); }
.logo-lg { width: 96px; height: 96px; display: block; margin: 0 auto 14px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: #eef0f3; color: var(--text);
  font-weight: 600; white-space: nowrap; transition: background .15s, transform .05s, opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.985); }
.btn-primary { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 6px 16px rgba(244, 123, 32, .28); }
.btn-primary:hover { background: var(--brand); }
.btn-ghost { background: #f0f1f4; color: var(--text-2); }
.btn-ghost:hover { background: #e7e9ed; }
.btn-outline { background: var(--brand-weak); color: var(--brand-dark); border-color: #f6b27d; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-block { display: flex; width: 100%; }
.btn-lg { min-height: 52px; font-size: 18px; letter-spacing: .1em; border-radius: 12px; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn.is-disabled, .btn:disabled { opacity: .5; pointer-events: none; box-shadow: none; }
.btn .spinner { display: none; width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.btn.is-busy { opacity: .85; pointer-events: none; }
.btn.is-busy .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  border: 0; background: transparent; color: var(--text); flex: none;
}
.icon-btn:hover { background: rgba(0,0,0,.05); }
.icon-btn .ic { width: 26px; height: 26px; }
.icon-btn-light { color: #fff; }
.icon-btn-light:hover { background: rgba(255,255,255,.15); }

/* ---------- layout ---------- */
.page { width: 100%; max-width: 680px; margin: 0 auto; padding: 16px 16px 32px; }
.page-wide { max-width: 1120px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }

.topbar { background: linear-gradient(100deg, #f7802a, #ff9d4d 75%, #ffb06a); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 10px rgba(244,123,32,.25); }
.topbar-inner { max-width: 1120px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.topbar h1 { margin: 0; font-size: 24px; letter-spacing: .06em; }

.appbar, .navbar {
  position: sticky; top: 0; z-index: 20; background: rgba(245,246,248,.92); backdrop-filter: saturate(1.5) blur(10px);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.appbar > :last-child, .navbar > :last-child { justify-self: end; }
.appbar h1, .navbar h1 { margin: 0; font-size: 21px; letter-spacing: .04em; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand b { font-size: 14px; color: var(--text-2); font-weight: 600; }
.brand small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- forms ---------- */
.field { margin-bottom: 18px; }
.field-label { display: flex; align-items: baseline; gap: 4px; flex-wrap: wrap; font-weight: 600; font-size: 16px; margin: 0 0 8px; }
.field-label em { color: var(--danger); font-style: normal; }
.field-label small { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-left: auto; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon > .ic { position: absolute; left: 14px; color: #9aa1ab; pointer-events: none; }
.input-icon input {
  width: 100%; min-width: 0; height: 50px; padding: 0 14px 0 46px; border: 1px solid #dfe2e7; border-radius: 12px;
  background: var(--field); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.input-icon input[type="datetime-local"] { display: flex; align-items: center; }
.input-icon input::placeholder { color: #a3a9b3; }
.input-icon input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(244,123,32,.15); }
.input-icon input.is-invalid { border-color: var(--danger); }
.input-lg input { height: 54px; }
/* 中文日期时间：原生选择器透明覆盖在上面负责选择，显示由 .cn-display 负责 */
.cn-picker {
  position: relative; display: flex; align-items: center; height: 50px; border: 1px solid #dfe2e7; border-radius: 12px;
  background: var(--field); cursor: pointer; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
.cn-picker > .ic { position: absolute; left: 14px; color: #9aa1ab; pointer-events: none; }
.cn-picker .cn-caret { left: auto; right: 14px; }
.cn-display { position: absolute; top: 0; bottom: 0; left: 46px; right: 40px; display: flex; align-items: center; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; font-variant-numeric: tabular-nums; }
.cn-display.is-empty { color: #a3a9b3; }
.cn-picker input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  opacity: 0; cursor: pointer; font-size: 16px; -webkit-appearance: auto; appearance: auto;
}
.cn-picker:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(244,123,32,.15); }
.cn-picker:has(input.is-invalid) { border-color: var(--danger); }
.cn-picker-sm { height: 38px; border-radius: 10px; flex: 1 1 130px; }
.cn-picker-sm > .ic { left: 10px; }
.cn-picker-sm .cn-display { left: 31px; right: 6px; font-size: 14px; }

.form-error {
  margin: 4px 0 16px; padding: 10px 14px; border-radius: 10px; background: #fdecec; color: #b42328;
  border: 1px solid #f7caca; font-size: 14px; white-space: pre-line;
}
.form-error a { text-decoration: underline; font-weight: 600; }

/* ---------- login ---------- */
.login-body { background: radial-gradient(circle at 50% 0, #fff 0, var(--bg) 70%); }
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-body:has(.site-footer) .login-wrap { min-height: calc(100vh - 56px); min-height: calc(100dvh - 56px); }

/* 页面底部备案号 */
.site-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; padding: 14px 16px calc(18px + var(--safe-b)); font-size: 12px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--text-2); text-decoration: underline; }
.has-action-bar .site-footer { padding-bottom: calc(96px + var(--safe-b)); }  /* 让出详情页底部固定按钮栏 */
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 22px; padding: 40px 28px 28px; box-shadow: 0 10px 40px rgba(17,24,39,.08); }
.login-card h1 { text-align: center; margin: 0 0 28px; font-size: 30px; letter-spacing: .08em; }
.login-card .field-label { margin-top: 16px; }
.login-card .btn { margin-top: 26px; }
.login-card .form-error { margin: 16px 0 0; }
.login-note { text-align: center; color: var(--muted); font-size: 12.5px; margin: 16px 0 0; }
.login-switch { text-align: center; color: var(--muted); font-size: 14px; margin: 18px 0 0; }
.login-switch a { color: var(--brand-dark); font-weight: 600; }
.login-card .field-label small { margin-left: auto; }
.login-card > .btn-block:last-child { margin-top: 22px; }

/* ---------- segmented ---------- */
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: #eef0f3; border: 1px solid #e3e6ea; border-radius: 14px; padding: 3px; margin-bottom: 22px; }
.seg { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; height: 54px; border-radius: 11px; font-size: 19px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background .15s, color .15s; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .ic { color: #6b7280; }
.seg:has(input:checked), .seg.is-active { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 4px 12px rgba(244,123,32,.3); }
.seg:has(input:checked) .ic, .seg.is-active .ic { color: #fff; }
.seg:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- photos (form) ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center;
  padding: 26px 16px 20px; border-radius: 14px; background: #f7f8fa; border: 2px dashed #d5d9df; cursor: pointer;
  transition: border-color .15s, background .15s; outline: none;
}
.dropzone:hover, .dropzone:focus-visible, .dropzone.is-drag { border-color: var(--brand); background: var(--brand-weak); }
.dropzone.is-full { opacity: .55; }
.dz-icon { width: 64px; height: 64px; color: #5f6773; stroke-width: 1.6; margin-bottom: 6px; }
.dropzone strong { font-size: 17px; }
.dropzone > span { color: var(--muted); font-size: 13px; }
.dz-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }
.dz-actions .btn-primary { box-shadow: none; }

.photo-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #e9ecf0; }
.ph img { width: 100%; height: 100%; object-fit: cover; }
.ph-file { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 11px; color: var(--text-2); padding: 4px; word-break: break-all; }
.ph-x { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; background: rgba(31,38,51,.78); color: #fff; display: grid; place-items: center; padding: 0; }
.ph-x .ic { width: 13px; height: 13px; stroke-width: 3; }
.ph-removed { display: none; position: absolute; inset: 0; background: rgba(31,38,51,.62); color: #fff; font-size: 12px; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.ph-undo { border: 0; background: #fff; color: var(--text); border-radius: 6px; font-size: 12px; padding: 2px 8px; }
.ph.is-removed .ph-removed { display: flex; }
.ph.is-removed .ph-x { display: none; }
.ph-tag { position: absolute; left: 4px; bottom: 4px; background: var(--brand); color: #fff; font-size: 10px; border-radius: 4px; padding: 0 4px; }
.ph-add { border: 2px dashed #d5d9df; background: #fafbfc; color: #8b929c; display: grid; place-items: center; }
.ph-add .ic { width: 30px; height: 30px; stroke-width: 1.6; }
.ph-add:hover { border-color: var(--brand); color: var(--brand); }
.noscript-file { margin-top: 10px; }

.record-form .btn-lg { margin-top: 8px; }
.record-form .btn-ghost.btn-block { margin-top: 10px; }

/* ---------- recent ---------- */
.recent { margin-top: 24px; padding: 14px 16px 6px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.card-head h2 { margin: 0; font-size: 18px; }
.card-head a { display: inline-flex; align-items: center; color: var(--muted); font-size: 14px; }
.recent-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.card-head + .recent-row { border-top: 0; }
.recent-thumb { width: 64px; height: 52px; border-radius: 8px; overflow: hidden; background: #e9ecf0; flex: none; }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-info { flex: 1; min-width: 0; }
.recent-info > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.recent-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-info small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-empty { padding: 8px 0 14px; margin: 0; }
.chevron { color: #9aa1ab; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px; border-radius: 7px; font-size: 13px; font-weight: 600; flex: none; line-height: 1.6; }
.badge-inbound { background: var(--in-bg); color: var(--in); }
.badge-outbound { background: var(--out-bg); color: var(--out); }

/* ---------- list ---------- */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.btn-action { min-height: 50px; font-size: 16px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); }
.btn-action .ic { width: 24px; height: 24px; }
.btn-action-in { color: var(--brand-dark); }
.btn-action-in .ic { color: var(--brand); }
.btn-action-out { color: var(--out); }

.filters { margin-bottom: 8px; }
.search { display: flex; align-items: center; gap: 8px; background: #eceef1; border-radius: 999px; padding: 4px 4px 4px 16px; }
.search > .ic { color: #6b7280; }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; height: 42px; font-size: 16px; outline: none; -webkit-appearance: none; }
.search input::placeholder { color: #8f96a0; }
.search:focus-within { box-shadow: 0 0 0 2px rgba(244,123,32,.35); background: #fff; }
.search-btn { border: 0; background: var(--brand); color: #fff; border-radius: 999px; height: 38px; padding: 0 16px; font-weight: 600; flex: none; }

/* 历史型号候选：登记与查询复用，长型号换行，手机可滚动点选。 */
.model-autocomplete { position: relative; }
.model-suggestions {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  max-height: 240px; overflow-y: auto; overscroll-behavior: contain;
  padding: 4px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.model-option { padding: 12px; min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.model-option:hover, .model-option[aria-selected="true"] { background: var(--brand-weak); color: var(--brand-dark); border-radius: 8px; }
.chips { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.chip-select .ic-sm { width: 15px; height: 15px; }
.chip { position: relative; display: inline-flex; align-items: center; cursor: pointer; }
.chip input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.chip span, .chip-select { display: inline-flex; align-items: center; justify-content: center; min-width: 56px; height: 38px; padding: 0 14px; border-radius: 999px; background: #eceef1; font-size: 15px; color: var(--text); transition: background .15s, color .15s; }
.chip input:checked + span { background: linear-gradient(180deg, var(--brand-2), var(--brand)); color: #fff; box-shadow: 0 4px 10px rgba(244,123,32,.28); }
.chip input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.chip-select { gap: 4px; padding: 0 10px 0 12px; position: relative; }
.chip-select select { border: 0; background: transparent; appearance: none; -webkit-appearance: none; font-size: 15px; padding: 0 2px; outline: none; cursor: pointer; }
.chip-select:has(select:focus-visible) { outline: 2px solid var(--brand); }
.custom-range { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 10px; }
.custom-range > .btn { grid-column: 1 / -1; }
.custom-range > span { color: var(--muted); }
.result-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; margin: 12px 2px 10px; }
.result-meta b { color: var(--text); }
.result-meta a { color: var(--brand-dark); flex: none; }
.range-hint { font-size: 12.5px; white-space: nowrap; }

.record-list { display: grid; gap: 12px; }
.record-card { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); min-width: 0; transition: box-shadow .15s, transform .1s; }
.record-card:hover { box-shadow: 0 2px 4px rgba(17,24,39,.05), 0 10px 24px rgba(17,24,39,.08); }
.record-card:active { transform: scale(.995); }
.thumbs { display: flex; gap: 6px; flex: none; }
.thumb { position: relative; width: 66px; height: 74px; border-radius: 8px; overflow: hidden; background: #e9ecf0; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-1 { width: 70px; }
.thumb-3 { display: none; }
.thumb-count { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(20,24,31,.5); color: #fff; font-weight: 600; font-size: 13px; letter-spacing: .04em; }
.thumb-3 .thumb-count { display: grid; }
.record-info { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; }
.record-info .badge { margin-bottom: 3px; }
.record-name { font-size: 16.5px; font-weight: 700; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record-qty { color: var(--brand-dark); }
.record-meta { color: var(--muted); font-size: 13px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.record-meta .mono { color: var(--text-2); }
/* 物流单号放不下时整体换到下一行显示完整，而不是截断 */
.record-meta.record-logistics { white-space: normal; overflow: visible; }
.record-logistics .mono { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.record-time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-card > .chevron { width: 18px; height: 18px; margin-left: -4px; }

.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 22px 0 6px; }
.pager-info { color: var(--muted); font-size: 14px; }

.empty { text-align: center; padding: 48px 16px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { margin: 0; }
.empty-ic { width: 54px; height: 54px; color: #c4c9d1; stroke-width: 1.4; }

@media (min-width: 480px) {
  .thumb-3 { display: block; }
  .thumb-count-m { display: none; }
  .thumb, .thumb-1 { width: 84px; height: 84px; }
  .thumb-1 { width: 96px; }
}
@media (min-width: 900px) {
  .record-list { grid-template-columns: 1fr 1fr; }
  .quick-actions { grid-template-columns: 220px 220px; justify-content: start; }
  .filters { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .search { flex: 1 1 380px; }
  .chips { margin-top: 0; }
  .custom-range { flex-basis: 100%; display: flex; }
  .custom-range > .btn { grid-column: auto; }
  .custom-range .cn-picker { flex: 0 1 190px; }
}

/* ---------- detail ---------- */
.page-detail { max-width: 920px; display: grid; gap: 14px; }
.has-action-bar .page { padding-bottom: calc(100px + var(--safe-b)); }
.info-card { overflow: hidden; }
.hero { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 14px; }
.hero-inbound { background: linear-gradient(180deg, #fff1e4, #fff8f1); }
.hero-outbound { background: linear-gradient(180deg, #e8f0fe, #f4f8ff); }
.hero-id { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.type-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 20px 8px 16px; border-radius: 12px; color: #fff; font-size: 20px; font-weight: 700; letter-spacing: .08em; }
.type-pill-inbound { background: linear-gradient(180deg, var(--brand-2), var(--brand)); box-shadow: 0 4px 12px rgba(244,123,32,.3); }
.type-pill-outbound { background: linear-gradient(180deg, #4f86f7, var(--out)); box-shadow: 0 4px 12px rgba(37,99,235,.28); }
.info-list { margin: 0; padding: 0 18px 4px; }
.info-list > div { display: grid; grid-template-columns: 88px 1fr; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); align-items: center; }
.info-list > div:first-child { border-top: 0; }
.info-list dt { color: var(--muted); font-size: 15px; }
.info-list dd { margin: 0; font-size: 16px; min-width: 0; word-break: break-word; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.info-list dd.strong { font-weight: 600; font-size: 17px; }
.info-list dd.muted { color: var(--muted); font-size: 14px; }
.copy-btn { display: inline-flex; align-items: center; gap: 3px; border: 1px solid var(--line); background: #fff; color: var(--text-2); font-size: 12px; border-radius: 6px; padding: 2px 8px; }
.copy-btn:hover { border-color: var(--brand); color: var(--brand-dark); }
.photos-card { padding: 16px; }
.photos-card h2 { margin: 0 0 12px; font-size: 18px; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.g-item { padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; background: #e9ecf0; cursor: zoom-in; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.g-item:hover img { transform: scale(1.03); }
@media (min-width: 720px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.action-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 12px 16px calc(12px + var(--safe-b)); }
.action-bar-inner { max-width: 920px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.action-bar .btn { min-height: 50px; font-size: 17px; }

/* ---------- account ---------- */
.page-account { display: grid; gap: 14px; max-width: 520px; }
.account-card { display: flex; align-items: center; gap: 14px; padding: 18px; }
.avatar { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: #fff; background: linear-gradient(180deg, var(--brand-2), var(--brand)); }
.account-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.account-card .role { flex: none; }
.account-info small { color: var(--muted); font-size: 13px; }
.account-info strong { font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-form { padding: 18px 18px 20px; }
.account-form h2 { margin: 0 0 6px; font-size: 18px; }
.account-form .field-label { margin-top: 14px; }
.account-form .field-label small { margin-left: auto; }
.account-form .form-error { margin: 14px 0 0; }
.account-note { color: var(--muted); font-size: 13px; margin: 14px 0 16px; }
.account-logout .btn { color: var(--danger); }
.invite-card { padding: 18px; }
.invite-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.invite-head h2 { margin: 0; font-size: 18px; }
.status { font-size: 12.5px; font-weight: 600; padding: 2px 10px; border-radius: 999px; }
.status-on { background: var(--in-bg); color: var(--in); }
.status-off { background: #eef0f3; color: var(--muted); }
.invite-code { margin: 14px 0 12px; padding: 14px; border-radius: 12px; background: var(--brand-weak); border: 1px dashed #f6b27d; color: var(--brand-dark); font-size: 22px; font-weight: 700; text-align: center; letter-spacing: .08em; }
.invite-copy, .invite-manage { display: flex; gap: 8px; flex-wrap: wrap; }
.invite-copy .btn { flex: 1 1 140px; }
.invite-manage { margin-top: 2px; }
.text-danger { color: var(--danger); }
.invite-last-used { margin-top: -6px; color: var(--text-2); }
.status-danger { background: #fdecec; color: var(--danger); }
.status-warn { background: #fff4e5; color: #b45309; }
.notice-warn { padding: 12px 14px; border-radius: 12px; background: #fff4e5; border: 1px solid #f6c98a; color: #8a4b0b; font-size: 14.5px; }
.users-card { padding: 18px; scroll-margin-top: 70px; }
.users-count { font-size: 13px; }
.user-list { list-style: none; margin: 10px 0 0; padding: 0; }
.user-row { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-row.is-disabled .user-name > span:first-child, .user-row.is-disabled .avatar { opacity: .5; }
.avatar-sm { width: 38px; height: 38px; font-size: 16px; }
.user-main { flex: 1; min-width: 0; }
.user-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.user-name > span:first-child { overflow-wrap: anywhere; }
.user-name .status { font-size: 11.5px; padding: 1px 8px; font-weight: 600; }
.user-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.user-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.user-actions .btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.temp-pw { margin: 12px 0 4px; padding: 12px 14px; border-radius: 12px; background: var(--brand-weak); border: 1px dashed #f6b27d; }
.temp-pw p { margin: 0; }
.temp-pw-row { display: flex; align-items: center; gap: 10px; margin: 8px 0 6px; flex-wrap: wrap; }
.temp-pw-code { font-size: 22px; font-weight: 700; color: var(--brand-dark); letter-spacing: .06em; }
.invite-custom { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.invite-custom summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
.invite-custom-form { display: flex; gap: 8px; margin-top: 10px; }
.invite-custom-form .input-icon { flex: 1; min-width: 0; }
.invite-custom-form .btn { flex: none; min-height: 50px; }
.invite-card .form-error { margin: 12px 0 0; }
.account-logout .ic { width: 20px; height: 20px; }

/* ---------- dialog ---------- */
.dialog { border: 0; border-radius: 18px; padding: 24px 22px 18px; width: min(92vw, 380px); text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(17,24,39,.45); }
.dialog h3 { margin: 6px 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 20px; color: var(--text-2); font-size: 14.5px; }
.dialog b { color: var(--danger); }
.dialog-icon { width: 52px; height: 52px; border-radius: 50%; background: #fdecec; color: var(--danger); display: grid; place-items: center; margin: 0 auto; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- lightbox ---------- */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(8,10,14,.94); display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.lb-img { max-width: 100vw; max-height: 100vh; max-height: 100dvh; object-fit: contain; user-select: none; }
.lb-btn { position: absolute; border: 0; background: rgba(255,255,255,.14); color: #fff; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255,255,255,.26); }
.lb-close { top: max(14px, env(safe-area-inset-top)); right: 14px; }
.lb-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 12px; top: 50%; transform: translateY(-50%); }
.lb-counter { position: absolute; bottom: calc(18px + var(--safe-b)); left: 50%; transform: translateX(-50%); color: #fff; font-size: 14px; background: rgba(255,255,255,.14); border-radius: 999px; padding: 3px 12px; font-variant-numeric: tabular-nums; }

/* ---------- drawer & toast ---------- */
.drawer { position: fixed; inset: 0; z-index: 90; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(17,24,39,.4); animation: fade .15s; }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(84vw, 320px); background: #fff; padding: 16px 12px; padding-top: max(16px, env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 4px; box-shadow: -8px 0 30px rgba(0,0,0,.12); animation: slide .2s ease-out; }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.drawer-head .logo-sm { color: var(--brand); }
.drawer-head > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.drawer-head small { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 12px; border-radius: 10px; font-size: 16px; border: 0; background: transparent; text-align: left; }
.drawer-link:hover { background: #f4f5f7; }
.drawer-link .ic { color: var(--text-2); }
.drawer-logout { margin-top: auto; border-top: 1px solid var(--line); padding-top: 6px; }
.drawer-logout .drawer-link { color: var(--danger); }
.drawer-logout .ic { color: var(--danger); }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }

.toast { position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 120; background: rgba(31,38,51,.92); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14.5px; box-shadow: 0 8px 24px rgba(0,0,0,.18); animation: toast-in .25s ease-out; max-width: calc(100vw - 32px); }
.toast.is-hiding { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -8px); } }

@media (max-width: 380px) {
  .brand span { display: none; }
  .photo-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .seg { font-size: 17px; }
}
@media (min-width: 900px) {
  .appbar, .navbar { padding-left: max(16px, calc(50vw - 540px)); padding-right: max(16px, calc(50vw - 540px)); }
}
