:root {
  --navy: #1f3a5f;
  --ink: #17283d;
  --muted: #5c6c7d;
  --pale: #f2f5f9;
  --white: #ffffff;
  --line: #d8e1ea;
  --green: #27685d;
  --cool: #edf5f2;
  --warm: #fbf1ed;
  --accent: #b0482c;
  --amber: #a66a12;
  --amber-bg: #fdf4e3;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(23, 40, 61, 0.08);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--pale);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--navy);
  white-space: nowrap;
}

.brand small {
  font-size: 10px;
  letter-spacing: .18em;
  color: var(--muted);
  font-weight: 600;
}

.mock-badge {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
}

.spacer { flex: 1; }

.role-switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--pale);
  border-radius: 999px;
}

.role-switch button {
  border: 0;
  background: transparent;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.role-switch button.active {
  background: var(--navy);
  color: #fff;
}

.approver-pick {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  font-size: 13px;
}

.stage {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

.phone {
  width: 100%;
  max-width: 430px;
  min-height: 720px;
  margin: 0 auto;
  background: var(--white);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-body { flex: 1; padding: 20px 20px 28px; }

.phone-nav {
  display: flex;
  border-top: 1px solid var(--line);
  background: #fff;
}

.phone-nav button {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 11px 4px 14px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.phone-nav button.active { color: var(--green); }

.screen-head { margin-bottom: 16px; }

.screen-head .eyebrow {
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.screen-head h1 {
  margin: 0;
  font-size: 22px;
  color: var(--navy);
  letter-spacing: .01em;
}

.screen-head p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.card.tint { background: var(--cool); border-color: #cfe3dc; }
.card.warn { background: var(--amber-bg); border-color: #efdcb8; }
.card.soft { background: var(--pale); }

.label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: .04em;
}

.amount {
  font-size: 40px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -.02em;
  line-height: 1.15;
}

.amount small { font-size: 18px; margin-left: 2px; }

.big-number {
  font-size: 30px;
  font-weight: 700;
  color: var(--navy);
}

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt8 { margin-top: 8px; }
.mt12 { margin-top: 12px; }
.mt16 { margin-top: 16px; }
.mt24 { margin-top: 24px; }
.mb8 { margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }

.divider { height: 1px; background: var(--line); margin: 14px 0; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 700;
  font-size: 14px;
  background: var(--navy);
  color: #fff;
  transition: transform .05s ease, opacity .15s ease;
}

.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.btn.soft { background: var(--cool); color: var(--green); border-color: #cfe3dc; }
.btn.danger { background: var(--accent); }
.btn.small { padding: 8px 12px; font-size: 12px; border-radius: 10px; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  font-size: 16px;
}

.input:focus { outline: 2px solid rgba(39, 104, 93, .25); border-color: var(--green); }

.money-input {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 14px;
  background: #fff;
}

.money-input input {
  border: 0;
  flex: 1;
  padding: 8px 0;
  font-size: 26px;
  font-weight: 700;
  text-align: right;
  outline: none;
  color: var(--navy);
  min-width: 0;
}

.money-input span { color: var(--muted); font-weight: 700; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.pending { background: var(--amber-bg); color: var(--amber); }
.badge.approved { background: #e8f1ee; color: var(--green); }
.badge.paid { background: #e8eef7; color: var(--navy); }
.badge.rejected { background: var(--warm); color: var(--accent); }
.badge.returned { background: var(--warm); color: var(--accent); }
.badge.cancelled { background: var(--pale); color: var(--muted); }
.badge.ok { background: #e8f1ee; color: var(--green); }
.badge.off { background: var(--pale); color: var(--muted); }

.list { display: flex; flex-direction: column; gap: 10px; }

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.list-item .grow { min-width: 0; }

.list-item .title { font-weight: 700; font-size: 14px; }
.list-item .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.list-item .amount-col { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { background: var(--pale); font-size: 11px; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5df;
  border: 0;
  padding: 0;
  transition: background .15s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left .15s ease;
}

.switch.on { background: var(--green); }
.switch.on::after { left: 21px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }

.chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--pale);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.chip strong { color: var(--navy); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 40, 61, .45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

@media (min-width: 720px) {
  .modal-backdrop { align-items: center; }
}

.modal {
  width: 100%;
  max-width: 520px;
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 24px 60px rgba(23, 40, 61, .28);
}

.modal h2 { margin: 0 0 6px; font-size: 20px; color: var(--navy); }
.modal .sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }

.search-results {
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-top: 10px;
}

.search-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: #fff;
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
}

.search-item:last-child { border-bottom: 0; }
.search-item:hover { background: var(--pale); }
.search-item .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--cool); color: var(--green);
  display: grid; place-items: center; font-weight: 700; font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 80;
  max-width: 90vw;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px 20px;
}

.login-card {
  width: 100%;
  max-width: 880px;
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 40px;
}

.login-card h1 { margin: 0 0 6px; font-size: 28px; color: var(--navy); }
.login-card .lead { color: var(--muted); font-size: 14px; line-height: 1.7; margin: 0 0 26px; }

.role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.role-card {
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  transition: border-color .15s ease, transform .1s ease;
}

.role-card:hover { border-color: var(--green); transform: translateY(-2px); }
.role-card .role-name { font-weight: 700; font-size: 17px; color: var(--navy); margin-bottom: 6px; }
.role-card .role-desc { font-size: 12px; color: var(--muted); line-height: 1.6; }

.banner {
  background: var(--cool);
  border: 1px solid #cfe3dc;
  color: var(--green);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 12px;
  line-height: 1.6;
  margin-bottom: 14px;
}

.warn-list { margin: 0; padding-left: 18px; color: var(--amber); font-size: 12px; line-height: 1.7; }

.kv { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: right; }

.progress {
  height: 8px;
  border-radius: 999px;
  background: #e6edf4;
  overflow: hidden;
}

.progress > span { display: block; height: 100%; background: var(--green); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input { max-width: 320px; }

.page-title { font-size: 26px; color: var(--navy); margin: 0 0 4px; }
.page-lead { color: var(--muted); font-size: 13px; margin: 0 0 22px; line-height: 1.6; }

@media (max-width: 760px) {
  .topbar { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
  .brand small { display: none; }
  .topbar .spacer { display: none; }
  .topbar .btn.ghost.small { margin-left: auto; }
  .topbar .role-switch { order: 10; width: 100%; }
  .topbar .role-switch button { flex: 1; }
  .stage { padding: 16px 12px 40px; }
  .login-card { padding: 26px 20px; }
  .phone { border-radius: 20px; min-height: 0; }
  .amount { font-size: 34px; }
}
