/* ロボット貸出管理 -- デザインシステム */
:root {
  --bg: #f5f6fb; --bg2: #eceef7; --card: #ffffff; --ink: #0f172a; --ink2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e6e8f0; --line2: #d5d9e6;
  --brand: #5b5bd6; --brand2: #8b5cf6; --brand-soft: #eeedff; --brand-ink: #4338ca;
  --teal: #0ea5a0; --teal-soft: #e0f7f5; --amber: #f59e0b; --amber-soft: #fff4dc; --rose: #e5484d; --rose-soft: #ffe8e8; --sky: #3b82f6; --sky-soft: #e6f0ff;
  --soarm: #ff8a3d; --rebot: #7c5cff; --j4012: #10b981;
  --r: 18px; --r-sm: 12px; --r-xs: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -16px rgba(15, 23, 42, .18);
  --shadow-lg: 0 24px 60px -24px rgba(15, 23, 42, .35);
  --font: 'Inter', 'Noto Sans JP', system-ui, -apple-system, 'Hiragino Sans', sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --lw: 232px; --dw: 40px; --rh: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100dvh; overflow-x: hidden; }
body.modal-open { overflow: hidden; }
a { color: var(--brand-ink); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: -.01em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- 起動・ログイン ---------- */
.boot { min-height: 100dvh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line2); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden;
  background: radial-gradient(900px 500px at 8% -10%, #e9e4ff 0%, transparent 60%), radial-gradient(800px 500px at 100% 110%, #d8f5f0 0%, transparent 60%), var(--bg); }
.login::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(15,23,42,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.045) 1px, transparent 1px); background-size: 36px 36px; mask-image: radial-gradient(60% 60% at 50% 40%, #000 30%, transparent 100%); pointer-events: none; }
.login-card { position: relative; width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 36px 32px 28px; box-shadow: var(--shadow-lg); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-logo .mark { width: 44px; height: 44px; border-radius: 14px; }
.login-logo .name { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.login-logo .sub { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.login h1 { font-size: 24px; font-weight: 800; margin-bottom: 6px; }
.login p.lead { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login .btn { width: 100%; justify-content: center; height: 48px; font-size: 16px; margin-top: 6px; }
.login .foot { margin-top: 20px; text-align: center; color: var(--faint); font-size: 12.5px; }
.login .err { background: var(--rose-soft); color: #b42318; border-radius: var(--r-xs); padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.login-fleet { display: flex; gap: 8px; margin-top: 22px; flex-wrap: wrap; }
.login-fleet span { font-size: 12px; color: var(--ink2); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- アプリの骨格 ---------- */
.topbar { position: sticky; top: 0; z-index: 40; background: rgba(245, 246, 251, .82); backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px); border-bottom: 1px solid rgba(15, 23, 42, .06); }
.topbar .wrap { display: flex; align-items: center; gap: 18px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; white-space: nowrap; }
.brand .mark { width: 34px; height: 34px; border-radius: 11px; }
.brand .t { font-size: 16px; }
.brand .s { display: block; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a { padding: 8px 14px; border-radius: 999px; color: var(--ink2); font-weight: 600; font-size: 14px; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(15, 23, 42, .05); }
.nav a.on { background: var(--ink); color: #fff; }
.spacer { flex: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--brand), var(--brand2)); font-size: 14px; text-transform: uppercase; border: 0; flex: none; }
.usermenu { position: relative; }
.menu { position: absolute; right: 0; top: 46px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; z-index: 50; }
.menu .who { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who b { display: block; }
.menu button { display: flex; width: 100%; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; gap: 10px; align-items: center; font-weight: 500; }
.menu button:hover { background: var(--bg); }
.menu button.danger { color: #b42318; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.main { padding: 26px 0 110px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head .desc { color: var(--muted); margin-top: 4px; font-size: 14px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabbar { display: none; }
.fab { display: none; }

/* ---------- ボタン・チップ・バッジ ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); font-weight: 600; font-size: 14px; transition: transform .12s, box-shadow .12s, background .12s, border-color .12s; white-space: nowrap; color: var(--ink); }
.btn:hover { background: var(--bg); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; border-color: transparent; box-shadow: 0 8px 20px -10px rgba(91, 91, 214, .8); }
.btn.primary:hover { filter: brightness(1.05); box-shadow: 0 10px 24px -10px rgba(91, 91, 214, .9); }
.btn.dark { background: var(--ink); color: #fff; border-color: transparent; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink2); }
.btn.ghost:hover { background: rgba(15, 23, 42, .06); }
.btn.soft { background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
.btn.teal { background: var(--teal); color: #fff; border-color: transparent; }
.btn.danger { color: #b42318; border-color: #f3c5c5; background: #fff; }
.btn.danger:hover { background: var(--rose-soft); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { width: 40px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 32px; }
.btn svg { width: 18px; height: 18px; flex: none; }
.seg { display: inline-flex; background: var(--bg2); border-radius: 12px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; font-weight: 600; font-size: 13.5px; color: var(--ink2); white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(15, 23, 42, .08); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); font-size: 13px; font-weight: 600; color: var(--ink2); }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.ty { border-color: transparent; color: #fff; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.planned { background: var(--sky-soft); color: #1d4ed8; }
.badge.out { background: var(--amber-soft); color: #b45309; }
.badge.overdue { background: var(--rose-soft); color: #b42318; }
.badge.returned { background: #eef0f4; color: var(--muted); }
.badge.maint { background: #eef0f4; color: var(--ink2); }
.badge.loc { background: var(--bg2); color: var(--ink2); font-weight: 600; }
.badge .dot { width: 7px; height: 7px; }
.tag { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px 0 7px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--ink2); white-space: nowrap; }
.tag .dot { width: 8px; height: 8px; }

/* ---------- カード・グリッド ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card .card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px 0; }
.card .card-h h2 { font-size: 16px; font-weight: 800; }
.card .card-b { padding: 16px 20px 20px; }
.grid { display: grid; gap: 16px; }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.home { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: start; }
.stack { display: grid; gap: 16px; }

/* ---------- ホーム ---------- */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.hero h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.hero .date { color: var(--muted); font-weight: 600; margin-top: 4px; }
.hero .cta { display: flex; gap: 8px; }
.stat { position: relative; overflow: hidden; padding: 18px 20px 16px; display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 14px; align-items: center; }
.stat-main { min-width: 0; }
.stat-pic { position: relative; z-index: 1; width: 112px; height: 84px; object-fit: cover; border-radius: 12px; background: #fff; border: 1px solid var(--line); box-shadow: 0 6px 16px -10px rgba(15, 23, 42, .35); }
.stat::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: var(--c); opacity: .08; }
.stat .ty { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink2); font-size: 13.5px; }
.stat .big { display: flex; align-items: baseline; gap: 6px; margin: 10px 0 10px; }
.stat .big b { font-size: 36px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat .big span { color: var(--muted); font-weight: 600; }
.segbar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--bg2); gap: 2px; }
.segbar i { display: block; height: 100%; }
.segbar i.free { background: var(--teal); }
.segbar i.out { background: var(--amber); }
.segbar i.plan { background: var(--sky); opacity: .55; }
.segbar i.maint { background: var(--faint); }
.stat .legend { display: flex; gap: 12px; margin-top: 10px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.stat .legend span { display: inline-flex; align-items: center; gap: 5px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi.alert .v { color: #b42318; }
.kpi.good .v { color: var(--teal); }
.heat { display: grid; grid-template-columns: 150px 1fr; gap: 10px 12px; align-items: center; }
.heat .lab { font-size: 13px; font-weight: 700; color: var(--ink2); display: flex; gap: 8px; align-items: center; min-width: 0; }
.heat .lab span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat .row { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; }
.heat .cell { height: 32px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--ink2); background: var(--l); position: relative; }
.heat .cell.today { outline: 2px solid var(--ink); outline-offset: -2px; }
.heat .cell.zero { color: #b42318; }
.heat .days { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 3px; grid-column: 2; }
.heat .days span { text-align: center; font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; }
.heat .days span.we { color: var(--rose); }
.heat .days span.today { color: var(--ink); }

/* ---------- 一覧の行 ---------- */
.rlist { display: flex; flex-direction: column; gap: 10px; }
.rrow { display: grid; grid-template-columns: 124px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); transition: border-color .12s, box-shadow .12s; cursor: pointer; min-width: 0; }
.rrow:hover { border-color: var(--line2); box-shadow: var(--shadow); }
.rrow .when { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rrow .when b { font-size: 15px; letter-spacing: -.01em; }
.rrow .when span { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.rrow .when .d { color: var(--ink2); font-weight: 700; font-size: 12px; }
.rrow .what { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.rrow .who { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .who .u { color: var(--muted); font-weight: 500; }
.rrow .items { display: flex; gap: 5px; flex-wrap: wrap; }
.rrow .reason { color: var(--ink2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rrow .right { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty .ill { width: 64px; height: 64px; margin: 0 auto 10px; border-radius: 20px; background: var(--bg2); display: grid; place-items: center; color: var(--faint); }
.empty b { color: var(--ink2); display: block; margin-bottom: 4px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search { flex: 1; min-width: 200px; max-width: 360px; }
.search { position: relative; }
.search input { width: 100%; height: 40px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); padding: 0 12px 0 38px; outline: none; }
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 91, 214, .15); }
.search svg { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--faint); }

/* ---------- 予定表（タイムライン） ---------- */
.tl-wrap { overflow: hidden; }
.tl-ctl { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tl-ctl .range { font-weight: 800; font-size: 16px; min-width: 190px; letter-spacing: -.01em; }
.tl-legend { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; margin-left: auto; }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend i { width: 18px; height: 10px; border-radius: 4px; display: inline-block; }
.tl-legend i.out { background: var(--amber); }
.tl-legend i.plan { background: #fff; border: 2px solid var(--sky); }
.tl-legend i.over { background: var(--rose); }
.tl-legend i.ret { background: var(--line2); }
.tl-scroll { overflow: auto; max-height: calc(100dvh - 250px); min-height: 360px; position: relative; scroll-padding-left: var(--lw); }
.tl { display: inline-block; min-width: 100%; }
.tl-row { display: flex; height: var(--rh); border-bottom: 1px solid var(--line); position: relative; }
.tl-row.group { height: 36px; background: var(--bg); position: sticky; top: 64px; z-index: 4; }
.tl-row.group .tl-label { background: var(--bg); font-weight: 800; font-size: 12.5px; color: var(--ink2); letter-spacing: .02em; white-space: nowrap; overflow: hidden; }
.tl-row.group .tl-cells { background: var(--bg); }
.tl-label { position: sticky; left: 0; z-index: 3; width: var(--lw); flex: none; background: var(--card); border-right: 1px solid var(--line2); display: flex; align-items: center; gap: 8px; padding: 0 12px; min-width: 0; }
.tl-label .nm { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.tl-label .lc { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; background: var(--bg2); border-radius: 6px; padding: 2px 6px; }
.tl-label .mt { font-size: 11px; color: #b42318; font-weight: 700; white-space: nowrap; }
.tl-cells { position: relative; display: flex; flex: none; }
.tl-cell { width: var(--dw); flex: none; border-right: 1px solid var(--line); height: 100%; cursor: pointer; }
.tl-cell:hover { background: var(--brand-soft); }
.tl-cell.we { background: #f8f8fc; }
.tl-cell.today { background: rgba(91, 91, 214, .07); }
.tl-row.group .tl-cell { cursor: default; }
.tl-row.group .tl-cell:hover { background: transparent; }
.tl-row.group .tl-cell.we, .tl-row.group .tl-cell.today { background: transparent; }
.tl-head { position: sticky; top: 0; z-index: 6; background: var(--card); box-shadow: 0 1px 0 var(--line2); }
.tl-head .tl-row { height: auto; border-bottom: 0; }
.tl-head .tl-label { z-index: 7; align-items: flex-end; padding-bottom: 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.tl-months { display: flex; height: 24px; }
.tl-month { flex: none; font-size: 12px; font-weight: 800; color: var(--ink2); padding: 4px 8px; border-right: 1px solid var(--line); white-space: nowrap; overflow: hidden; position: sticky; left: var(--lw); }
.tl-days { display: flex; height: 40px; }
.tl-day { width: var(--dw); flex: none; text-align: center; border-right: 1px solid var(--line); padding-top: 3px; line-height: 1.15; }
.tl-day b { display: block; font-size: 13px; font-weight: 700; }
.tl-day span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.tl-day.we b, .tl-day.we span { color: var(--rose); }
.tl-day.today b { background: var(--ink); color: #fff; border-radius: 999px; width: 24px; height: 24px; display: grid; place-items: center; margin: 0 auto; }
.bar { position: absolute; top: 7px; height: calc(var(--rh) - 14px); border-radius: 9px; display: flex; align-items: center; padding: 0 9px; font-size: 12.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; z-index: 2; color: #fff; background: var(--c); box-shadow: 0 2px 6px -2px rgba(15, 23, 42, .3); transition: transform .12s, box-shadow .12s; }
.bar:hover { transform: translateY(-1px); box-shadow: 0 6px 14px -6px rgba(15, 23, 42, .45); z-index: 3; }
.bar.planned { background: #fff; color: var(--ink); border: 2px solid var(--c); box-shadow: none; }
.bar.overdue { background: repeating-linear-gradient(135deg, var(--rose) 0 8px, #ff6b6f 8px 16px); }
.bar.returned { background: var(--line2); color: var(--muted); box-shadow: none; z-index: 1; }
.bar .u { font-weight: 500; opacity: .85; margin-left: 5px; }
.tl-empty { padding: 60px 20px; text-align: center; color: var(--muted); }

/* ---------- 機材 ---------- */
.itable { width: 100%; border-collapse: collapse; }
.itable th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.itable td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.itable tr:last-child td { border-bottom: 0; }
.itable .nm { font-weight: 700; white-space: nowrap; }
.itable select, .itable input { height: 34px; border-radius: 9px; border: 1px solid var(--line2); background: var(--card); padding: 0 8px; max-width: 100%; }
.itable input { width: 100%; min-width: 120px; }
.itable .now { font-size: 13px; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 600; white-space: nowrap; }
.switch input { appearance: none; min-width: 0; width: 38px; height: 22px; border-radius: 999px; background: var(--line2); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked { background: var(--teal); }
.switch input:checked::after { left: 19px; }
.type-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.type-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.type-head .cnt { color: var(--muted); font-weight: 600; font-size: 13px; }

/* ---------- フォーム ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink2); }
.field label i { color: var(--rose); font-style: normal; margin-left: 3px; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .field input, .field select, .field textarea { height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); padding: 0 12px; outline: none; width: 100%; transition: border-color .12s, box-shadow .12s; min-width: 0; }
.field textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(91, 91, 214, .15); }
.field input[type="date"] { -webkit-appearance: none; appearance: none; font-family: var(--font); }
.frow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-err { background: var(--rose-soft); color: #b42318; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.form-ok { background: var(--teal-soft); color: #0f766e; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick button { height: 30px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); font-size: 12.5px; font-weight: 600; padding: 0 11px; color: var(--ink2); }
.quick button:hover { background: var(--bg); }
.dur { font-weight: 800; color: var(--brand-ink); }
.pick { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.pick .tabs { display: flex; border-bottom: 1px solid var(--line); background: var(--bg); overflow-x: auto; }
.pick .tabs button { flex: 1; border: 0; background: transparent; padding: 10px 6px; font-weight: 700; font-size: 13px; color: var(--ink2); display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; border-bottom: 2px solid transparent; white-space: nowrap; overflow: hidden; }
.pick .tabs button .tt { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pick .tabs button .selc { background: var(--brand); color: #fff; border-radius: 999px; min-width: 20px; height: 20px; padding: 0 6px; font-size: 11.5px; display: inline-grid; place-items: center; }
.pick .tabs button span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.pick .tabs button.on { color: var(--ink); border-bottom-color: var(--ink); background: var(--card); }
.pick .body { padding: 12px; }
.pick .auto { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; font-size: 13px; color: var(--ink2); }
.pick .auto .step { display: inline-flex; align-items: center; border: 1px solid var(--line2); border-radius: 10px; overflow: hidden; }
.pick .auto .step button { width: 34px; height: 34px; border: 0; background: var(--card); font-size: 18px; font-weight: 700; }
.pick .auto .step b { width: 42px; text-align: center; font-size: 15px; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.unit { position: relative; border: 1.5px solid var(--line2); border-radius: 12px; padding: 9px 8px; background: var(--card); text-align: left; display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: border-color .12s, background .12s, transform .12s; }
.unit b { font-size: 14px; }
.unit span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit:hover:not(:disabled) { border-color: var(--ink); }
.unit.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-ink); }
.unit.on::after { content: "✓"; position: absolute; right: 8px; top: 7px; font-weight: 800; font-size: 13px; }
.unit:disabled { opacity: .55; cursor: not-allowed; background: var(--bg); }
.unit:disabled span { color: #b45309; }
.unit.maint:disabled span { color: var(--muted); }
.summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border-radius: 12px; padding: 10px 14px; font-size: 13.5px; flex-wrap: wrap; }
.summary b { color: var(--brand-ink); }

/* ---------- モーダル・ドロワー ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; animation: fade .15s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal { background: var(--card); border-radius: 22px; width: min(720px, 100%); box-shadow: var(--shadow-lg); animation: rise .18s ease-out; display: flex; flex-direction: column; max-height: calc(100dvh - 80px); }
.modal.narrow { width: min(460px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px 0; }
.modal-h h2 { font-size: 20px; font-weight: 800; }
.modal-h .x { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--bg2); display: grid; place-items: center; }
.modal-b { padding: 16px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-f .left { margin-right: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sec { display: flex; flex-direction: column; gap: 10px; }
.sec h3 { font-size: 13px; font-weight: 800; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.sec h3 .n { width: 22px; height: 22px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; }
.detail .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.detail .period { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.detail .period small { font-size: 14px; color: var(--muted); font-weight: 600; margin-left: 8px; }
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.kv dd .pre { white-space: pre-wrap; }
.hist { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; }
.hist li { list-style: none; }
.hist ul { margin: 0; padding: 0; }
.ulist { display: flex; flex-direction: column; gap: 8px; }
.urow { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.urow .nm { font-weight: 700; }
.urow .meta { font-size: 12.5px; color: var(--muted); }
.urow .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.urow.off { opacity: .6; }
.banner { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #fff7e6, #fff1d6); border: 1px solid #fde4b8; border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; flex-wrap: wrap; }
.banner b { color: #92400e; }
.banner .btn { margin-left: auto; }
.pwbox { font-family: var(--mono); background: var(--bg); border: 1px dashed var(--line2); border-radius: 10px; padding: 10px 12px; font-size: 15px; letter-spacing: .04em; display: flex; justify-content: space-between; align-items: center; gap: 10px; overflow-wrap: anywhere; }

/* ---------- トースト ---------- */
#toast-root { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 480px); }
.toast { background: var(--ink); color: #fff; border-radius: 12px; padding: 11px 16px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: rise .18s ease-out; display: flex; gap: 10px; align-items: center; max-width: 100%; }
.toast.err { background: #b42318; }
.toast.ok { background: #0f766e; }

/* ---------- レスポンシブ ---------- */
@media (max-width: 1000px) {
  .grid.home { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .nav a { padding: 8px 11px; font-size: 13.5px; }
}
@media (max-width: 900px) {
  .itable thead { display: none; }
  .itable, .itable tbody { display: block; width: 100%; }
  .itable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; border-bottom: 1px solid var(--line); padding: 12px 14px; }
  .itable td { display: block; padding: 0; border: 0; min-width: 0; }
  .itable td::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
  .itable td.nm::before { display: none; }
  .itable td.nm, .itable td.now, .itable td.memo { grid-column: 1 / -1; }
  .itable td.nm { font-size: 15px; }
  .itable select { width: 100%; }
}
@media (max-width: 760px) {
  :root { --lw: 124px; --dw: 36px; --rh: 42px; }
  body { font-size: 14.5px; }
  .wrap { padding: 0 14px; }
  .topbar .wrap { height: 56px; gap: 10px; }
  .brand .mark { width: 30px; height: 30px; border-radius: 9px; }
  .brand .t { font-size: 15px; }
  .nav, .topbar .cta-top { display: none; }
  .main { padding: 18px 0 110px; }
  .hero h1 { font-size: 23px; }
  .hero .cta { display: none; }
  .page-head h1 { font-size: 22px; }
  .grid.c3, .grid.c4, .grid.c2 { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .v { font-size: 22px; }
  .heat { grid-template-columns: 1fr; gap: 6px; }
  .heat .lab { margin-top: 6px; }
  .heat .days { grid-column: 1; }
  .heat .cell { height: 28px; font-size: 11px; border-radius: 6px; }
  .rrow { grid-template-columns: 1fr; gap: 8px; padding: 12px 14px; }
  .rrow .right { flex-direction: row; align-items: center; justify-content: space-between; }
  .rrow .reason { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .tl-ctl { padding: 10px 12px; gap: 8px; }
  .tl-ctl .range { font-size: 14px; min-width: 0; width: 100%; order: -1; }
  .tl-legend { margin-left: 0; width: 100%; }
  .tl-scroll { max-height: calc(100dvh - 300px); min-height: 320px; }
  .tl-label { padding: 0 8px; }
  .tl-label .nm { font-size: 12.5px; }
  .tl-label .lc { display: none; }
  .bar { font-size: 11.5px; padding: 0 6px; border-radius: 7px; }
  .frow { grid-template-columns: 1fr; }
  .overlay { padding: 0; align-items: flex-end; }
  .modal, .modal.narrow { width: 100%; border-radius: 22px 22px 0 0; max-height: 96dvh; }
  .modal-h { padding: 16px 16px 0; }
  .modal-h h2 { font-size: 18px; }
  .modal-b { padding: 14px 16px; gap: 16px; }
  .modal-f { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  .modal-f .btn { flex: 1; justify-content: center; }
  .modal-f .left { width: 100%; margin-right: 0; order: 3; justify-content: center; margin-top: 2px; }
  .modal-f .left .btn { flex: 0 0 auto; border-color: transparent; background: transparent; }
  .units { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); }
  .urow { grid-template-columns: 36px minmax(0, 1fr); }
  .urow .acts { grid-column: 1 / -1; justify-content: flex-start; }
  .kv { grid-template-columns: 84px 1fr; }
  .detail .period { font-size: 19px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; background: rgba(255, 255, 255, .92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 6px 0 4px; border-radius: 12px; }
  .tabbar a svg { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--brand-ink); }
  .tabbar a.on svg { color: var(--brand); }
  .fab { display: grid; place-items: center; position: fixed; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; box-shadow: 0 12px 30px -10px rgba(91, 91, 214, .9); z-index: 61; }
  .fab svg { width: 28px; height: 28px; }
  #toast-root { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .login-card { padding: 28px 22px 22px; border-radius: 20px; }
}
@media (max-width: 400px) {
  :root { --lw: 118px; --dw: 32px; }
  .stat { grid-template-columns: minmax(0, 1fr) 96px; }
  .stat-pic { width: 96px; height: 72px; }
  .tl-label .nm { font-size: 12px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .seg button { padding: 7px 10px; font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
