:root {
  --bg: #eef2f4;
  --card: #ffffff;
  --ink: #10222b;
  --muted: #61727d;
  --line: #dde6ea;
  --accent: #0f766e;
  --accent-ink: #e6fffb;
  --navy: #0f2f33;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 34, 43, .06), 0 8px 24px -12px rgba(16, 34, 43, .18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: 84px;
}
a { color: inherit; text-decoration: none; }
b, strong { font-weight: 700; }
small { font-size: .78em; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: var(--navy); color: #fff; padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, #14b8a6, #0f766e); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .5px;
}
.brand b { display: block; font-size: 15px; line-height: 1.15; }
.brand small { display: block; color: #9fbcc0; font-size: 11px; }
.brand.big .brand-mark { width: 46px; height: 46px; font-size: 17px; }
.brand.big b { font-size: 20px; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.today { color: #cbe3e4; }
.logout { color: #9fbcc0; border: 1px solid #2c5459; padding: 4px 10px; border-radius: 999px; }
.logout:hover { color: #fff; }

.tabs { display: none; gap: 4px; padding: 0 16px; background: var(--navy); }
.nav-item { color: #cbe3e4; padding: 8px 14px; border-radius: 10px 10px 0 0; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.nav-item.on { background: var(--bg); color: var(--ink); font-weight: 700; }

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav .nav-item { flex-direction: column; gap: 2px; border-radius: 0; padding: 8px 0 10px; font-size: 11px; color: var(--muted); background: none; }
.bottomnav .nav-item.on { color: var(--accent); font-weight: 700; background: none; }
.nav-ico { font-size: 17px; line-height: 1; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 14px 14px 28px; }
.wrap.wide { max-width: 1280px; }

.hero {
  background: linear-gradient(140deg, #0f2f33, #134a4c 60%, #0f766e);
  color: #fff; border-radius: 18px; padding: 16px; box-shadow: var(--shadow);
}
.hero-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.hero .kpi { background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); box-shadow: none; }
.hero .kpi-label { color: #bfe0e0; }
.hero .kpi-sub { color: #a7cccc; }
.hero-actions { display: flex; gap: 8px; margin-top: 12px; }
.hero-actions .btn { flex: 1; background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); color: #fff; }
.hero-actions .btn.primary { background: #14b8a6; border-color: #14b8a6; color: #04231f; font-weight: 800; }

.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi-label { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.kpi-value { font-size: 26px; font-weight: 800; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 12px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.kpi-sub { font-size: 11px; color: var(--muted); }
.kpi.danger .kpi-value { color: var(--danger); }
.kpi.ok .kpi-value { color: var(--ok); }
.kpi.accent .kpi-value { color: var(--accent); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin-top: 12px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 10px; font-size: 15px; display: flex; align-items: baseline; gap: 8px; }
.panel h2 small { color: var(--muted); font-weight: 500; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.panel-head h2 { margin: 0; }
.panel-head p { margin: 2px 0 0; }
.link { color: var(--accent); font-size: 13px; font-weight: 600; }
.count { background: #fee2e2; color: var(--danger); border-radius: 999px; padding: 1px 8px; font-size: 12px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.kpis.small .kpi-value { font-size: 20px; }

.grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.alerts { display: grid; gap: 6px; }
.alert { display: block; padding: 9px 12px; border-radius: 10px; background: #f6f8f9; border-left: 4px solid var(--line); font-size: 13px; }
.alert.over { border-left-color: var(--danger); background: #fef2f2; }
.alert.today { border-left-color: var(--warn); background: #fffbeb; }
.alert.warn { border-left-color: #ca8a04; background: #fefce8; }

.vcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.vcard.is-busy { border-left: 4px solid var(--accent); }
.vcard.is-sale { border-left: 4px solid #94a3b8; opacity: .92; }
.vcard.is-idle { border-left: 4px solid #cbd5e1; }
.vcard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.vcard-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vcard-title b { font-size: 15px; }
.plate { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; background: #eef4f5; border: 1px solid var(--line); padding: 1px 7px; border-radius: 6px; color: #33545a; }
.vcard-meta { display: grid; gap: 3px; }
.row { display: flex; gap: 8px; font-size: 13px; }
.row .k { color: var(--muted); min-width: 42px; font-size: 11px; padding-top: 2px; }
.row .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .v.strong { font-weight: 700; }
.row .v.over { color: var(--danger); font-weight: 700; }
.row .v.today { color: var(--warn); font-weight: 700; }
.row .v.soon { color: var(--warn); }
.row .v em { font-style: normal; font-size: 11px; }
.vcard-actions { display: flex; gap: 6px; }
.vcard-actions .btn { flex: 1; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.badge.busy { background: #ccfbf1; color: #0f766e; }
.badge.idle { background: #eef2f4; color: #64748b; }
.badge.sale { background: #e2e8f0; color: #475569; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; min-height: 40px;
}
.btn:hover { border-color: #c3d0d6; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.sm { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.btn.lg { min-height: 46px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: default; }

.toolbar { display: flex; flex-direction: column; gap: 8px; }
.search input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; background: #fff; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.chip { white-space: nowrap; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip b { font-weight: 700; }

.rental-layout { display: grid; gap: 12px; }
.photo-panel { margin-top: 0; }
.dropzone { position: relative; display: grid; place-items: center; min-height: 190px; border: 2px dashed #cbd8dd; border-radius: 12px; background: #f8fbfb; overflow: hidden; cursor: pointer; }
.dropzone img { display: contents; }
.dropzone img[src] { display: block; width: 100%; max-height: 340px; object-fit: contain; background: #000; }
.dz-text { position: absolute; text-align: center; color: var(--muted); font-size: 14px; }
.dropzone img[src] + .dz-text { display: none; }
.ocr-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

.form-panel h2 { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #fff; font-family: inherit; -webkit-appearance: none; appearance: none; }
.field input:focus, .field select:focus { outline: 2px solid #99f6e4; border-color: var(--accent); }
.field.full { grid-column: 1 / -1; }
.hint { font-size: 12px; color: var(--muted); min-height: 16px; }
.req { color: var(--danger); font-size: 10px; }
.submit-row { display: flex; gap: 8px; margin-top: 14px; }
.submit-row .btn { flex: 1; }
.submit-row .btn.primary { flex: 2; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.err { color: var(--danger); font-size: 13px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 11px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid #f0f4f6; vertical-align: middle; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .pos { color: var(--ok); }
.tbl .neg { color: var(--danger); }
.tbl a { color: var(--accent); font-weight: 600; }
.bar { position: relative; height: 18px; background: #eef2f4; border-radius: 999px; min-width: 90px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #5eead4, #0f766e); }
.bar span { position: relative; display: block; text-align: center; font-size: 11px; font-weight: 700; line-height: 18px; color: #0b3b38; }
.empty { color: var(--muted); text-align: center; padding: 24px 0; }

.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; background: linear-gradient(160deg, #0f2f33, #0b1f22); }
.login-card { width: 100%; max-width: 360px; background: #fff; border-radius: 18px; padding: 24px; box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5); }
.login-card .brand { color: var(--ink); margin-bottom: 18px; }
.login-card .brand small { color: var(--muted); }
.stack { display: grid; gap: 12px; }
.stack label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.stack input { padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; }

dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(420px, 92vw); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); }
dialog.modal::backdrop { background: rgba(6, 24, 27, .5); backdrop-filter: blur(2px); }
.modal-inner { padding: 18px; }
.modal-inner h3 { margin: 0 0 4px; font-size: 16px; }
.modal-sub { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.modal-inner .field { margin-bottom: 10px; }
.modal-actions { display: flex; gap: 8px; margin-top: 6px; }
.modal-actions .btn { flex: 1; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #10222b; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; z-index: 60; box-shadow: var(--shadow); }

.print-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.fax { background: #fff; padding: 18px 22px; border-radius: 8px; box-shadow: var(--shadow); }
.fax-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 10px; }
.fax-head h1 { font-size: 17px; margin: 0 0 4px; }
.fax-head p { margin: 0; font-size: 12px; }
.fax-note { margin-top: 4px !important; color: #444; }
.fax-contact { font-size: 12px; text-align: right; line-height: 1.7; white-space: nowrap; }
.fax-tbl { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.fax-tbl th, .fax-tbl td { border: 1px solid #999; padding: 3px 4px; }
.fax-tbl th { background: #eef2f4; font-size: 10px; }
.fax-tbl .c { text-align: center; }
.fax-tbl .st-busy { background: #ccfbf1; font-weight: 700; }
.fax-tbl .st-sale { background: #e2e8f0; color: #475569; }
.fax-foot { margin-top: 8px; font-size: 11px; text-align: right; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .hero-kpis { grid-template-columns: repeat(4, 1fr); }
  .grid2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .tabs { display: flex; }
  .bottomnav { display: none; }
  body { padding-bottom: 0; }
  .grid { grid-template-columns: repeat(3, 1fr); }
  .rental-layout { grid-template-columns: 380px 1fr; align-items: start; }
  .photo-panel { position: sticky; top: 88px; }
  .kpi-value { font-size: 28px; }
}

@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body { background: #fff; padding: 0; }
  .topbar, .tabs, .bottomnav, .print-tools { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .fax { box-shadow: none; padding: 0; border-radius: 0; }
  .fax-tbl th, .fax-tbl td { padding: 2px 3px; }
  .fax-tbl { font-size: 9pt; }
}

.share-mail { background: #f1f8f7; border: 1px solid #cfe7e3; border-radius: 10px; padding: 10px 12px; overflow-x: auto; }
.share-mail code { font-size: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.steps { margin: 12px 0 18px; padding-left: 22px; font-size: 14px; }
.steps li { margin-bottom: 8px; }

.thumb { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

.vcard-badges { display: flex; align-items: center; gap: 6px; }
.tire { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 2px 8px; font-size: 11px; font-weight: 700; cursor: pointer; font-family: inherit; line-height: 1.5; }
.tire.summer { background: #fff7e6; border-color: #f5d9a8; color: #92400e; }
.tire.winter { background: #e8f1ff; border-color: #c3d8fb; color: #1d4ed8; }
.tire.big { font-size: 15px; padding: 2px 12px; }
.tire:active { transform: scale(.94); }
.bulk-tire { align-items: center; }
.bulk-tire .chip { cursor: pointer; font-family: inherit; }
