:root{
  --bg:#0b0d12; --card:#121826; --line:#263042; --text:#e8eefc; --muted:#a7b3cc;
  --accent:#6ea8ff; --danger:#ff6e6e; --ok:#66d19e; --warn:#ffd66e;
  --field:#0f1422;
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0;
  padding: 14px;
  padding-top: calc(14px + env(safe-area-inset-top, 0px));
  padding-right: calc(14px + env(safe-area-inset-right, 0px));
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  padding-left: calc(14px + env(safe-area-inset-left, 0px));
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  background:linear-gradient(180deg, #080a10, var(--bg));
  color:var(--text);
}
input, select, textarea, button { font-size:16px; }

.wrap{ max-width:980px; margin:0 auto; }
header{
  display:flex; align-items:center; justify-content:space-between;
  gap:10px; margin-bottom:10px; flex-wrap:wrap;
}
h1{ font-size:16px; margin:0; letter-spacing:.02em; }
.tabs{ display:flex; gap:8px; }
.tab{
  border:1px solid var(--line); background:transparent; color:var(--text);
  padding:9px 10px; border-radius:12px; cursor:pointer; font-weight:900;
}
.tab.active{ background:rgba(110,168,255,.12); border-color:rgba(110,168,255,.45); }
.card{
  background:rgba(18,24,38,.85);
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.hr{ height:1px; background:var(--line); margin:10px 0; }

label{ display:block; font-size:12px; color:var(--muted); margin-bottom:6px; }
input, select, textarea{
  width:100%;
  padding:11px 11px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--field);
  color:var(--text);
  outline:none;
}
textarea{ min-height:96px; resize:vertical; }

.row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.row > * { flex:1; min-width:160px; }

.btn{
  width:auto;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid var(--line);
  background:var(--field);
  color:var(--text);
  cursor:pointer;
  font-weight:900;
}
.btn.primary{ background:rgba(110,168,255,.16); border-color:rgba(110,168,255,.45); }
.btn.ok{ background:rgba(102,209,158,.12); border-color:rgba(102,209,158,.45); }
.btn.danger{ background:rgba(255,110,110,.12); border-color:rgba(255,110,110,.45); }
.small{ font-size:12px; color:var(--muted); }
.hidden{ display:none !important; }

.pill{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:10px 12px; border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
  font-weight:900;
}
.money{ font-variant-numeric: tabular-nums; font-feature-settings:"tnum"; }

/* メイン上段：名前 + ランクを1行 */
.main-employee-row{ display:flex; gap:10px; align-items:center; }
.main-employee-row select{ flex:1; min-width:0; }
.main-rank{
  flex:0 0 auto;
  min-width:44px;
  text-align:center;
  padding:10px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.03);
  font-weight:1000;
  letter-spacing:.05em;
}

/* 接客カード */
.session{
  border:1px solid rgba(255,255,255,.10);
  border-radius:14px;
  padding:10px;
  background:var(--field);
  margin-bottom:10px;
}
.session-head{ display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:8px; }
.session-title{ font-weight:1000; font-size:13px; }

.session-line2{ display:grid; grid-template-columns: 1fr 1fr; gap:8px; }
.pill-compact{ padding:10px 12px; border-radius:14px; margin-top:8px; }

/* オプション：2列 */
.optbox{
  border:1px solid rgba(255,255,255,.08);
  border-radius:12px;
  padding:8px;
  background: rgba(255,255,255,.02);
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
}
.optitem{ display:flex; gap:8px; align-items:center; border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.02); padding:8px; border-radius:12px; }
.optitem input{ width:auto; }
.optname{ font-size:12px; font-weight:900; line-height:1.2; }

/* 集計 */
.summary-card{ border:1px solid rgba(255,255,255,.10); border-radius:14px; padding:12px; background: rgba(255,255,255,.02); margin-top:12px; }
.summary-title{ font-weight:1000; margin:0 0 10px 0; font-size:13px; }
.summary-pill{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 10px; border-radius:14px; border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.02); font-weight:1000; margin-top:8px; }
.summary-big{ padding:12px 14px; border-radius:16px; border:1px solid rgba(110,168,255,.45); background: rgba(110,168,255,.10); font-weight:1000; }
.checkline{ display:flex; align-items:center; justify-content:space-between; gap:10px; padding:10px 10px; border-radius:14px; border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.02); margin-top:8px; }
.checkline .left{ display:flex; gap:10px; align-items:center; font-weight:1000; }
.checkline input{ width:auto; }
.neg{ color: #ffb0b0; }
.pos{ color: #cfe0ff; }

.breakdown{ border:1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.02); border-radius:14px; padding:10px 12px; }
.break-row{ display:flex; justify-content:space-between; gap:10px; padding:7px 0; border-bottom:1px solid rgba(255,255,255,.06); }
.break-row:last-child{ border-bottom:none; }
.break-left{ display:flex; gap:10px; align-items:center; }
.count{ color:var(--muted); font-size:12px; font-weight:900; }

/* 設定 */
.editor-card{ border:1px solid rgba(255,255,255,.10); border-radius:14px; padding:10px; background: var(--field); }
.amount-input{ width:100%; min-width:0; text-align:right; padding:11px 11px; }

/* iPhone: 確実に収める */
@media (max-width: 560px){
  body{ padding:12px; padding-top: calc(12px + env(safe-area-inset-top, 0px)); }
  .card{ padding:12px; }
  .tabs{ width:100%; }
  .tabs .tab{ flex:1; }
  .row > *{ min-width: 0; }
  #viewSettings .row{ flex-direction: column; align-items: stretch; }
  #viewSettings .row > *{ width:100%; }
  #viewSettings .break-row{ flex-wrap: wrap; gap:10px; align-items:flex-start; }
  #optionList .break-row > div,
  #employeeList .break-row > div{ width:100% !important; min-width:0 !important; flex: 1 1 100% !important; }
  #optionList .break-row > div .btn,
  #employeeList .break-row > div .btn{ width:100% !important; }
  select{ padding-right: 34px; }
}
