/* ===== EE的FFXIV購物車 ===== */

:root {
  --bg: #f7f2e8;
  --bg-2: #ffffff;
  --bg-3: #f1e8d4;
  --line: #e1d3b5;
  --line-2: #cbb587;
  --text: #2c2417;
  --text-dim: #5c5140;
  --text-faint: #8a7d67;
  --gold: #a97a1a;
  --gold-hi: #7c580f;
  --gold-dim: #c9a862;
  --tank: #2f6fb0;
  --healer: #1c8b5b;
  --dps: #bd433c;
  --ok: #2f9e44;
  --shadow: 0 10px 28px rgba(70, 52, 20, .14);
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

body {
  background-image:
    radial-gradient(ellipse at 20% -10%, rgba(201, 158, 74, .10), transparent 55%),
    radial-gradient(ellipse at 90% 0%, rgba(47, 111, 176, .06), transparent 50%);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-hi); }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* ===== 版面 ===== */
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 253, 248, .96), rgba(247, 242, 232, .88));
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 60;
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}
.brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: .04em;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 9px;
}
.brand .mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border: 1px solid var(--gold-dim);
  border-radius: 6px;
  font-size: .78rem;
  color: var(--gold-hi);
  background: rgba(169, 122, 26, .10);
}
.header-sub {
  color: var(--text-faint);
  font-size: .82rem;
  border-left: 1px solid var(--line);
  padding-left: 16px;
}
.header-nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.header-nav a {
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 7px;
  font-size: .88rem;
  border: 1px solid transparent;
}
.header-nav a:hover { background: var(--bg-3); color: var(--text); }
.header-nav a.active { color: var(--gold); border-color: var(--line-2); background: var(--bg-3); }

/* ===== Session Controls ===== */
.session-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
}
.header-nav .session-controls {
  margin-left: 4px;
}
.site-header .wrap > .session-controls {
  margin-left: auto;
}
.session-controls .btn-mini {
  white-space: nowrap;
}

/* ===== 製作履歷檢查 ===== */
.history-panel {
  border-color: var(--gold-dim);
}
.history-ok,
.history-warning,
.history-error {
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: .92rem;
  line-height: 1.5;
}
.history-ok {
  background: rgba(47, 158, 68, .12);
  color: var(--ok);
}
.history-warning {
  background: rgba(189, 67, 60, .12);
  color: var(--dps);
}
.history-error {
  background: rgba(169, 122, 26, .12);
  color: var(--gold-hi);
}
.history-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--bg-2);
}
.history-row.pending {
  border-color: rgba(189, 67, 60, .45);
  background: rgba(189, 67, 60, .08);
}
.history-row.done {
  border-color: var(--gold-dim);
  background: rgba(169, 122, 26, .08);
}
.history-badge {
  display: inline-block;
  font-size: .75rem;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
  font-weight: 600;
}
.history-badge.pending {
  background: rgba(189, 67, 60, .16);
  color: var(--dps);
}
.history-badge.done {
  background: rgba(169, 122, 26, .16);
  color: var(--gold-hi);
}
.history-item-name {
  font-weight: 600;
  color: var(--text);
}
.history-item-meta,
.history-item-counts {
  font-size: .84rem;
  color: var(--text-dim);
  margin-top: 3px;
  word-break: break-word;
}
.history-ack {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-size: .9rem;
  color: var(--text-dim);
  margin: 10px 0;
}
.history-ack input {
  margin-top: 3px;
}

/* ===== Index 入口 ===== */
.hero {
  text-align: center;
  padding: 70px 20px 44px;
}
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 5vw, 3.1rem);
  letter-spacing: .06em;
  color: var(--gold);
  text-shadow: 0 2px 24px rgba(201, 169, 97, .25);
}
.hero .rule {
  width: 190px; height: 1px; margin: 20px auto;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}
.hero p { color: var(--text-dim); margin: 0; }

.entry-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 26px;
  padding: 10px 0 22px;
}
.entry-card {
  display: block;
  position: relative;
  overflow: hidden;
  padding: 44px 36px 40px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--bg-2), var(--bg));
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  color: var(--text);
  min-height: 260px;
}
.entry-card::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 78% 12%, rgba(201, 158, 74, .18), transparent 58%);
  opacity: 0; transition: opacity .25s ease;
  pointer-events: none;
}
.entry-card:hover { transform: translateY(-5px); border-color: var(--gold-dim); box-shadow: var(--shadow); }
.entry-card:hover::after { opacity: 1; }
.entry-card .badge {
  display: inline-block;
  font-size: .72rem;
  letter-spacing: .16em;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  border-radius: 999px;
  padding: 3px 12px;
  margin-bottom: 18px;
}
.entry-card h2 {
  margin: 0 0 10px;
  font-size: 2.2rem;
  letter-spacing: .1em;
  color: var(--gold-hi);
}
.entry-card .desc { color: var(--text-dim); font-size: .92rem; margin: 0 0 20px; }
.entry-card ul { margin: 0; padding-left: 18px; color: var(--text-faint); font-size: .86rem; }
.entry-card ul li { margin-bottom: 4px; }
.entry-card .go {
  margin-top: 24px;
  color: var(--gold);
  font-size: .88rem;
  letter-spacing: .08em;
}

.secondary-entry {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--text-dim);
  transition: border-color .18s ease, background .18s ease;
}
.secondary-entry:hover { border-color: var(--gold-dim); background: var(--bg); }
.secondary-entry .badge {
  font-size: .65rem;
  letter-spacing: .12em;
  color: var(--text-faint);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  padding: 3px 9px;
}
.secondary-entry-copy { display: grid; gap: 3px; min-width: 0; }
.secondary-entry-copy strong { color: var(--text); font-size: 1rem; font-weight: 600; }
.secondary-entry-copy span { font-size: .82rem; }
.secondary-go { color: var(--text-faint); font-size: .82rem; white-space: nowrap; }
.secondary-entry:hover .secondary-go { color: var(--gold); }

@media (max-width: 780px) {
  .entry-grid { grid-template-columns: 1fr; }
  .secondary-entry { grid-template-columns: auto minmax(0, 1fr); gap: 12px; }
  .secondary-go { grid-column: 2; }
}

/* ===== 篩選列 ===== */
.page-head { padding: 26px 0 6px; }
.page-head h1 {
  margin: 0 0 4px;
  font-size: 1.55rem;
  color: var(--gold);
  letter-spacing: .05em;
}
.page-head p { margin: 0; color: var(--text-faint); font-size: .86rem; }

.filters {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 14px 16px;
  margin: 18px 0;
}
.filter-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 6px 0;
}
.filter-row + .filter-row { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 12px; }
.filter-label {
  flex: 0 0 62px;
  color: var(--text-faint);
  font-size: .82rem;
  padding-top: 5px;
  letter-spacing: .06em;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.chip {
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 4px 13px;
  font-size: .82rem;
  transition: all .15s ease;
  white-space: nowrap;
}
.chip:hover { color: var(--text); border-color: var(--gold-dim); }
.chip.on { background: rgba(201, 158, 74, .18); border-color: var(--gold); color: var(--gold-hi); }
.chip.role-head {
  background: transparent; border: none; color: var(--text-faint);
  padding-left: 0; padding-right: 4px; font-size: .78rem; cursor: default;
}
.chip-sep { width: 100%; height: 0; }

.filter-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.btn-mini {
  background: transparent; border: 1px solid var(--line-2); color: var(--text-dim);
  border-radius: 7px; padding: 4px 11px; font-size: .8rem;
}
.btn-mini:hover { border-color: var(--gold-dim); color: var(--gold); }

.result-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  color: var(--text-faint); font-size: .84rem; margin-bottom: 10px;
}
.result-bar .count { color: var(--gold); }
.btn-bulk { margin-left: auto; }

/* ===== 裝備清單 ===== */
.item-list { display: flex; flex-direction: column; gap: 8px; padding-bottom: 120px; }

.item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  padding: 12px 14px;
  transition: border-color .15s ease, background .15s ease;
}
.item:hover { border-color: var(--line-2); background: var(--bg-3); }
.item.in-cart { border-color: var(--gold-dim); box-shadow: inset 3px 0 0 var(--gold); }

.item-main { flex: 1; min-width: 0; }
.item-title {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-weight: 600; font-size: 1rem; color: var(--text);
}
.item-title .name { color: var(--gold-hi); }
.item-note { color: var(--text-faint); font-size: .76rem; }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tag {
  font-size: .72rem;
  padding: 1px 8px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  background: rgba(0, 0, 0, .02);
}
.tag.slot { border-color: var(--gold-dim); color: var(--gold-hi); }
.tag.group { border-color: var(--line-2); color: var(--text-faint); }
.tag.job { font-size: .7rem; }
.tag.job.tank { border-color: rgba(47,111,176,.4); color: var(--tank); background: rgba(47,111,176,.06); }
.tag.job.healer { border-color: rgba(28,139,91,.4); color: var(--healer); background: rgba(28,139,91,.06); }
.tag.job.dps { border-color: rgba(189,67,60,.38); color: var(--dps); background: rgba(189,67,60,.06); }

.mats { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 6px; }
.mat {
  font-size: .78rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 9px;
  color: var(--text-dim);
}
.mat b { color: var(--gold); font-weight: 600; margin-left: 3px; }
.mat.im { border-color: var(--gold-dim); }

.item-actions { display: flex; align-items: center; gap: 6px; padding-top: 2px; }

.btn-add {
  background: linear-gradient(180deg, rgba(201,158,74,.22), rgba(201,158,74,.10));
  border: 1px solid var(--gold-dim);
  color: var(--gold-hi);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: .85rem;
  white-space: nowrap;
  transition: all .15s ease;
}
.btn-add:hover { background: rgba(201,158,74,.32); border-color: var(--gold); }
.btn-add:active { transform: scale(.96); }

.qty-ctrl { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.qty-ctrl button {
  background: var(--bg-3); border: none; color: var(--text-dim);
  width: 28px; height: 30px; font-size: 1rem; line-height: 1;
}
.qty-ctrl button:hover { background: var(--line); color: var(--gold); }
.qty-ctrl .n { min-width: 30px; text-align: center; color: var(--gold-hi); font-size: .9rem; }

.empty { text-align: center; color: var(--text-faint); padding: 60px 0; }

/* ===== 懸浮購物車 ===== */
.cart-fab {
  position: fixed;
  right: 22px; bottom: 26px;
  z-index: 90;
  display: flex; align-items: center; gap: 9px;
  background: linear-gradient(180deg, #fffdf9, #f8efd9);
  border: 1px solid var(--gold-dim);
  color: var(--gold-hi);
  border-radius: 999px;
  padding: 12px 20px;
  box-shadow: var(--shadow);
  font-size: .92rem;
}
.cart-fab:hover { border-color: var(--gold); }
.cart-fab .n {
  background: var(--gold); color: #fffaf0;
  border-radius: 999px; min-width: 22px; height: 22px;
  display: grid; place-items: center;
  font-size: .78rem; font-weight: 700; padding: 0 6px;
}

.cart-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px; max-width: 92vw;
  background: var(--bg-2);
  border-left: 1px solid var(--line-2);
  box-shadow: -14px 0 40px rgba(0,0,0,.5);
  z-index: 100;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .24s cubic-bezier(.3,.7,.3,1);
}
.cart-panel.open { transform: translateX(0); }

.cart-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.cart-head h3 { margin: 0; font-size: 1rem; color: var(--gold); letter-spacing: .06em; }
.cart-head .n { color: var(--text-faint); font-size: .82rem; }
.cart-close {
  margin-left: auto; background: transparent; border: none;
  color: var(--text-faint); font-size: 1.3rem; line-height: 1; padding: 2px 6px;
}
.cart-close:hover { color: var(--gold); }

.cart-body { flex: 1; overflow-y: auto; padding: 10px 14px; }
.cart-line {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--line);
}
.cart-line .info { flex: 1; min-width: 0; }
.cart-line .nm { font-size: .9rem; color: var(--text); }
.cart-line .sub { font-size: .74rem; color: var(--text-faint); }
.cart-line .rm { background: transparent; border: none; color: var(--text-faint); font-size: 1rem; padding: 2px 4px; }
.cart-line .rm:hover { color: var(--dps); }

.cart-foot { border-top: 1px solid var(--line); padding: 14px; display: flex; flex-direction: column; gap: 9px; }

.btn {
  border-radius: 9px;
  padding: 11px 16px;
  font-size: .92rem;
  border: 1px solid var(--line-2);
  background: var(--bg-3);
  color: var(--text);
  text-align: center;
  display: block;
  transition: all .15s ease;
  width: 100%;
}
.btn:hover { border-color: var(--gold-dim); color: var(--gold-hi); }
.btn-primary {
  background: linear-gradient(180deg, #fdf1d4, #f5e2ac);
  border-color: var(--gold-dim);
  color: var(--gold-hi);
  font-weight: 600;
}
.btn-primary:hover { background: linear-gradient(180deg, #fbe8ba, #efd794); border-color: var(--gold); }
.btn-ghost { background: transparent; color: var(--text-faint); border-color: var(--line); }
.btn-ghost:hover { color: var(--dps); border-color: rgba(189,67,60,.5); }

.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 95;
  opacity: 0; pointer-events: none;
  transition: opacity .24s ease;
}
.overlay.on { opacity: 1; pointer-events: auto; }

/* ===== 素材總計頁 ===== */
/* minmax(0, 1fr)：左欄不讓內容的 min-content 撐大自己，
   否則素材列一多就會把右邊固定 340px 的欄位擠掉，畫面比例會隨內容跳動 */
.mat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 22px;
  align-items: start;
  padding-bottom: 60px;
}
.mat-layout > * { min-width: 0; }
@media (max-width: 900px) { .mat-layout { grid-template-columns: 1fr; } }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  overflow: hidden;
  margin-bottom: 18px;
}
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.015);
}
/* 標題與按鈕固定寬度不換行，中間的提示字自己吸收長度變化，
   這樣提示文字變長變短時整條標題列的版面不會跳動 */
.panel-head h2 {
  margin: 0; font-size: .98rem; color: var(--gold); letter-spacing: .05em;
  flex: none; white-space: nowrap;
}
.panel-head .hint {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: auto;
  text-align: right;
  color: var(--text-faint);
  font-size: .78rem;
  line-height: 1.35;
}
.panel-body { padding: 6px 16px 14px; }

.mat-group-title {
  color: var(--text-faint);
  font-size: .78rem;
  letter-spacing: .1em;
  margin: 14px 0 6px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--line);
}
.mat-group-title .group-check-label {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; color: inherit;
}

.mat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 6px;
  border-radius: 7px;
}
.mat-row:hover { background: var(--bg-3); }
.mat-row.done { opacity: .45; }
.mat-row.done .mat-name { text-decoration: line-through; }
.mat-row label { display: flex; align-items: center; gap: 12px; flex: 1; cursor: pointer; min-width: 0; }
.mat-row input[type=checkbox],
.chk-box {
  appearance: none; -webkit-appearance: none;
  width: 19px; height: 19px; flex: none;
  border: 1px solid var(--line-2); border-radius: 5px;
  background: var(--bg); position: relative; cursor: pointer;
  transition: all .15s ease;
}
.mat-row input[type=checkbox]:hover,
.chk-box:hover { border-color: var(--gold-dim); }
.mat-row input[type=checkbox]:checked,
.chk-box:checked { background: var(--ok); border-color: var(--ok); }
.mat-row input[type=checkbox]:checked::after,
.chk-box:checked::after {
  content: '✓'; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: #fffdf8; font-size: .8rem; font-weight: 700;
}
.chk-box:indeterminate { background: var(--gold-dim); border-color: var(--gold-dim); }
.chk-box:indeterminate::after {
  content: ''; position: absolute; left: 4px; right: 4px; top: 47%;
  height: 2px; border-radius: 2px; background: #fffdf8;
}
.mat-name { flex: 1; min-width: 0; }
.mat-qty { color: var(--gold); font-weight: 600; font-variant-numeric: tabular-nums; }
.mat-sub { font-size: .74rem; color: var(--text-faint); margin-top: 1px; }

.tag-scrip {
  display: inline-block;
  font-size: .68rem;
  padding: 0 6px;
  line-height: 1.6;
  border-radius: 5px;
  border: 1px solid var(--gold-dim);
  color: var(--gold-hi);
  background: rgba(201,158,74,.12);
  margin-left: 7px;
  vertical-align: middle;
}

.mat-copy-btn {
  flex: none;
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--text-faint);
  border-radius: 6px;
  width: 26px; height: 26px;
  font-size: .82rem;
  line-height: 1;
  transition: all .15s ease;
}
.mat-copy-btn:hover { border-color: var(--gold-dim); color: var(--gold-hi); background: rgba(201,158,74,.10); }
.mat-copy-btn:active { transform: scale(.92); }

.progress {
  height: 5px; border-radius: 99px; background: var(--bg-3);
  overflow: hidden; margin: 4px 0 2px;
}
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width .3s ease; }

.cart-items-table { width: 100%; }
.ci-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 6px; border-bottom: 1px dashed var(--line);
}
.ci-row:last-child { border-bottom: none; }
.ci-row .nm { flex: 1; }
.ci-row .nm b { color: var(--gold-hi); font-weight: 600; }

.route-toggle { display: flex; gap: 4px; }
.route-toggle button {
  background: var(--bg-3); border: 1px solid var(--line-2); color: var(--text-dim);
  font-size: .76rem; padding: 3px 10px; border-radius: 6px;
}
.route-toggle button.on { background: rgba(201,158,74,.18); border-color: var(--gold); color: var(--gold-hi); }

/* ===== Toast ===== */
.toast-host {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #fffaef; border: 1px solid var(--gold-dim); color: var(--gold-hi);
  padding: 10px 20px; border-radius: 9px; font-size: .88rem;
  box-shadow: var(--shadow);
  animation: toastIn .25s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--text-faint);
  font-size: .78rem;
  padding: 20px;
  text-align: center;
  margin-top: 40px;
}

/* ===== 密碼閘門 / 暱稱輸入 ===== */
html.locked body > *:not(.gate) { visibility: hidden; }

.gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 50% -10%, rgba(201, 158, 74, .18), transparent 60%);
}
.gate-box {
  width: 100%;
  max-width: 380px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
  text-align: center;
}
.gate-mark {
  width: 44px; height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gold); color: #fff;
  font-weight: 700; letter-spacing: .5px;
}
.gate-box h1 { margin: 0 0 6px; font-size: 20px; }
.gate-box p { margin: 0 0 18px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.gate-box input {
  width: 100%;
  padding: 11px 13px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
}
.gate-box input:focus { outline: 2px solid var(--gold-dim); outline-offset: 1px; }
.gate-box button { width: 100%; margin-top: 14px; justify-content: center; }
.gate-err { min-height: 20px; margin-top: 7px; color: var(--dps); font-size: 13px; }

/* ===== EE 列表 ===== */
.order-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  margin-bottom: 12px;
  overflow: hidden;
}
.order-card.done { opacity: .62; }
.order-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 14px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--line);
}
.order-card-head .who { font-weight: 700; font-size: 15px; }
.order-card-head .when { color: var(--text-faint); font-size: 12px; }
.order-card-head .spacer { flex: 1; }
.order-body { padding: 10px 14px 12px; }
.order-body .line { display: flex; gap: 8px; padding: 2px 0; font-size: 13px; }
.order-body .line .q { color: var(--text-faint); }
.order-sub {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--text-dim);
}
.status-pill {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--text-dim);
  background: var(--bg-2);
}
.status-pill.done { color: #fff; background: var(--ok); border-color: var(--ok); }

/* 素材長條：自備 / 已有 / 尚缺 */
.matbar-row { padding: 9px 0; border-bottom: 1px solid var(--line); }
.matbar-row:last-child { border-bottom: none; }
.matbar-top {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; margin-bottom: 5px;
}
.matbar-top .nm { font-weight: 600; }
.matbar-top .spacer { flex: 1; }
.matbar-top .num { color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.matbar-top .lack { color: var(--dps); font-weight: 700; }
.matbar-top .enough { color: var(--ok); font-weight: 700; }
.matbar-top input {
  width: 66px; padding: 3px 6px; text-align: right;
  border: 1px solid var(--line-2); border-radius: 6px;
  background: var(--bg); color: var(--text); font-family: inherit; font-size: 13px;
}
.matbar {
  display: flex;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--bg-3);
  border: 1px solid var(--line);
}
.matbar i { display: block; height: 100%; }
.matbar i.self { background: var(--tank); }
.matbar i.have { background: var(--ok); }
.matbar i.lack { background: repeating-linear-gradient(45deg, #e6c9c7, #e6c9c7 5px, #f2dedd 5px, #f2dedd 10px); }
.matbar-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-dim); }
.matbar-legend span { display: inline-flex; align-items: center; gap: 5px; }
.matbar-legend b { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.matbar-legend b.self { background: var(--tank); }
.matbar-legend b.have { background: var(--ok); }
.matbar-legend b.lack { background: #e6c9c7; }

/* 入口頁的紀錄 */
.event-list { display: flex; flex-direction: column; }
.event-row {
  display: flex; gap: 10px; align-items: baseline;
  padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px;
}
.event-row:last-child { border-bottom: none; }
.event-row .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-dim); flex: none; }
.event-row .dot.done { background: var(--ok); }
.event-row .dot.delete { background: var(--dps); }
.event-row .t { margin-left: auto; color: var(--text-faint); font-size: 12px; white-space: nowrap; }

/* 製作素材底下的子素材 */
.matbar-row.sub {
  padding-left: 14px;
  border-bottom: none;
  padding-top: 5px;
  padding-bottom: 5px;
}
.matbar-row.sub + .matbar-row:not(.sub) { border-top: 1px solid var(--line); }
.matbar-row.sub .nm { font-weight: 400; color: var(--text-dim); }
.matbar-row.sub .matbar { height: 8px; }
.matbar-top .xiv-name { align-items: center; }
.matbar-top .sub-tick,
.stock-name .sub-tick {
  display: inline-flex;
  flex: 0 0 14px;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  color: var(--line-2);
}

.btn-craft {
  font-family: inherit;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--gold-dim);
  background: var(--bg-3);
  color: var(--gold-hi);
  white-space: nowrap;
}
.btn-craft:hover { background: var(--gold); border-color: var(--gold); color: #fff; }

/* ===== 素材庫存維護 ===== */
.stock-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.stock-toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.stock-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
}

.stock-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.stock-row:last-child { border-bottom: none; }
.stock-row.sub { padding-left: 14px; }
.stock-row.sub .stock-name > div:first-child { color: var(--text-dim); font-weight: 400; }
.stock-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; }
.stock-name > div:first-child { display: flex; align-items: center; gap: 6px; }
.stock-need { font-size: 12px; color: var(--text-dim); white-space: nowrap; text-align: right; }
.stock-need .lack { color: var(--dps); font-weight: 700; }
.stock-need .enough { color: var(--ok); font-weight: 700; }

.stock-ctrl { display: flex; align-items: center; gap: 4px; flex: none; }
.stock-ctrl button {
  width: 28px; height: 28px;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--bg-2);
  color: var(--text-dim);
  line-height: 1;
  display: grid; place-items: center;
}
.stock-ctrl button:hover { background: var(--gold); border-color: var(--gold); color: #fff; }
.stock-ctrl input {
  width: 62px;
  padding: 4px 6px;
  text-align: center;
  border: 1px solid var(--line-2);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}

/* 取消勾選（不計入總計）的訂單 */
.order-card.off .order-card-head { background: var(--bg); }
.order-card.off .order-body { opacity: .5; }
.order-card.off:not(.done) .order-card-head .who { color: var(--text-faint); }
.order-card-head .chk-box { flex: none; margin: 0 2px 0 0; }
.panel-head .btn-mini { flex: none; margin-left: 0; white-space: nowrap; }

/* 訂單卡片標題列：兩顆操作按鈕永遠綁在一起，不會一個留在上一行 */
.order-card-head .who,
.order-card-head .when,
.order-card-head .status-pill { flex: none; }
.order-actions { display: flex; gap: 6px; flex: none; margin-left: auto; }
.order-actions .btn-mini { white-space: nowrap; }

/* 訂單總計：可展開的「整套裝備」 */
.ci-row.set-row { cursor: pointer; user-select: none; }
.ci-row.set-row:hover { background: var(--bg-3); }
.set-caret {
  flex: none;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: none; background: transparent;
  color: var(--gold); font-size: .8rem; line-height: 1;
  padding: 0;
}
.ci-row.sub {
  padding-left: 30px;
  border-bottom: none;
  background: linear-gradient(90deg, var(--bg-3), transparent 70%);
}
.ci-row.sub .nm b { color: var(--text-dim); font-weight: 500; }
.ci-row.sub + .ci-row:not(.sub) { border-top: 1px dashed var(--line); }

/* 訂單總計：已經做好的那一列 */
.ci-row.is-done .nm b { text-decoration: line-through; color: var(--text-faint); }
.ci-row.is-done { opacity: .6; }
.ci-row .chk-box { flex: none; }

/* 面板頁籤（素材總計 / 訂單總計 / 已完成訂單） */
.tabs { display: flex; gap: 6px; flex: none; flex-wrap: wrap; }
.tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-faint);
  font-family: inherit;
  font-size: .92rem;
  letter-spacing: .05em;
  padding: 5px 12px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s ease;
}
.tab:hover { color: var(--gold-hi); }
.tab.is-active {
  color: var(--gold);
  border-color: var(--gold-dim);
  background: rgba(201,158,74,.12);
}
.tab-count {
  margin-left: 6px;
  font-size: .74rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
}
.tab.is-active .tab-count { color: var(--gold-hi); }

/* XIVAPI item icons */
.xiv-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.xiv-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  object-fit: contain;
  image-rendering: auto;
  vertical-align: middle;
}
.xiv-icon.sm {
  width: 27px;
  height: 27px;
  flex-basis: 27px;
}
.mat .xiv-name { gap: 4px; }
.mat .xiv-icon { width: 27px; height: 27px; flex-basis: 27px; }
.mat-name .xiv-name,
.stock-name .xiv-name,
.order-body .line .xiv-name,
.order-sub .xiv-name { align-items: flex-start; }
.stock-name > div:first-child .xiv-name { align-items: center; }
.xiv-name.history-item-name { font: inherit; }
.xiv-material-list { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 3px; }
.xiv-material-list .xiv-icon { width: 27px; height: 27px; flex-basis: 27px; }
