:root {
  --navy: #12355B; --navy-dark: #0B2440; --ink: #0F2238; --muted: #566577; --line: #E3E8EE;
  --ground: #F5F7FA; --accent: #2BA8E0; --accent-soft: rgba(43,168,224,.12); --accent-line: rgba(43,168,224,.35);
  --neg-bg: #FDEEE3; --neg-fg: #9A3F0C; --ok-bg: #E3F4EF; --ok-fg: #0B6B57; --ok-dot: #12A37F;
  --off-bg: #EEF1F5; --off-fg: #3D4B5C; --err-bg: #FDECEC; --err-fg: #A12828;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink);
  font-family: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', sans-serif; font-size: 14px; }
a { color: var(--navy); } a:hover { color: var(--navy-dark); }
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.muted { color: var(--muted); }
h1 { margin: 0; font-size: 24px; } h2 { margin: 0; font-size: 16px; }

/* layout */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 20px 16px; gap: 24px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 8px; text-decoration: none; }
.brand img { width: 52px; height: 42px; object-fit: contain; }
.brand b { display: block; font-size: 15px; color: var(--ink); }
.brand small { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 500; position: relative; }
.nav a.on { background: var(--accent-soft); color: var(--navy); font-weight: 700; }
.nav a.on::before { content: ""; position: absolute; left: 4px; width: 3px; height: 18px; border-radius: 2px; background: var(--accent); }
.nav .lock { margin-left: auto; color: #8A97A6; display: flex; }
.me { margin-top: auto; border-top: 1px solid var(--line); padding-top: 16px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff; display: flex;
  align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.me-name { font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.role.admin { background: var(--navy); color: #fff; } .role.viewer { background: var(--off-bg); color: var(--off-fg); }
.iconbtn { display: flex; width: 36px; height: 36px; align-items: center; justify-content: center; color: var(--muted); border-radius: 8px; }
main { flex-grow: 1; min-width: 0; padding: 32px 40px 48px; display: flex; flex-direction: column; gap: 24px; max-width: 1200px; }
.topbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
.topbar p { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.mhead, .tabbar { display: none; }

/* parts */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.pad { padding: 24px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px;
  border-radius: 10px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; color: var(--ink); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-dark); }
.btn.big { height: 48px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; border-radius: 8px; font-weight: 500; }
.btn:disabled { opacity: .45; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 500; color: var(--muted); }
.input, select.input { height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit;
  font-size: 14px; color: var(--ink); background: #fff; min-width: 0; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 1px solid var(--line);
  border-radius: 10px; background: #fff; }
.searchbox input { border: none; outline: none; font: inherit; font-size: 14px; flex-grow: 1; background: transparent; min-width: 0; }
.pill { display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; }
.pill.on { background: var(--ok-bg); color: var(--ok-fg); } .pill.on .dot { background: var(--ok-dot); }
.pill.off { background: var(--off-bg); color: var(--off-fg); } .pill.off .dot { background: #8A97A6; }
.pill.warn { background: var(--neg-bg); color: var(--neg-fg); } .pill.warn .dot { background: var(--neg-fg); }
.bar { height: 10px; border-radius: 999px; background: #EDF1F5; overflow: hidden; }
.bar.thin { height: 8px; }
.bar > div { height: 100%; border-radius: 999px; background: var(--accent); }
.kw { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: var(--neg-bg); color: var(--neg-fg); white-space: nowrap; }
.notice { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-radius: 10px; background: #F1F4F8; font-size: 13px; color: var(--off-fg); }
.flash { padding: 12px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok-fg); } .flash.err { background: var(--err-bg); color: var(--err-fg); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.kpi .v { font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 500; }
.kpi .l, .kpi .n { font-size: 12px; color: var(--muted); }
.grid53 { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; }
.list-row { padding: 14px 0; border-top: 1px solid var(--line); }
.prefrow { display: grid; grid-template-columns: 120px minmax(0, 1fr) 72px; gap: 16px; align-items: center; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { font-size: 13px; padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.r, th.r { text-align: right; }
.tablewrap { overflow-x: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 999px; font-size: 13px;
  font-weight: 700; text-decoration: none; border: 1px solid #D5DCE4; background: #fff; color: var(--ink); white-space: nowrap; }
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip .c { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 500; opacity: .8; }
.kwchip { display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 4px 0 12px; border-radius: 999px;
  border: 1px solid #D5DCE4; background: #fff; }
.kwchip.off { background: #F1F4F8; border-color: var(--line); }
.kwchip.off .w { color: #8A97A6; text-decoration: line-through; }
.kwchip form { display: inline; margin: 0; }
.kwchip .w { border: none; background: transparent; padding: 0; font: inherit; font-size: 13px; cursor: pointer; color: var(--ink); }
.kwchip .x { width: 26px; height: 26px; border: none; border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px; }
.kwbox { max-height: 380px; overflow-y: auto; padding: 4px 2px; }
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 180px;
  border: 2px dashed var(--accent-line); border-radius: 14px; background: var(--accent-soft); color: var(--navy);
  cursor: pointer; text-align: center; padding: 20px; }
.drop.has { border-style: solid; }
.rescard { padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.sug { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: var(--ground); }
.only-m { display: none; }

/* login */
.loginwrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.loginbox { width: 100%; max-width: 420px; padding: 40px 36px; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.loginbox img { width: 220px; height: 220px; object-fit: contain; }
.loginbox .btn { width: 100%; height: 50px; }

/* mobile */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .shell { flex-direction: column; }
  .mhead { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
  .mhead img { width: 40px; height: 32px; object-fit: contain; }
  .mhead .t small { display: block; font-size: 11px; color: var(--muted); }
  .mhead .t b { font-size: 17px; }
  .mhead .role { margin-left: auto; }
  main { padding: 16px 16px 96px; gap: 14px; }
  .topbar { display: none; }
  .pad { padding: 18px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; } .kpi .v { font-size: 22px; } .kpi .n { display: none; }
  .grid53 { grid-template-columns: 1fr; }
  .prefrow { grid-template-columns: 90px minmax(0, 1fr) 56px; gap: 10px; }
  .hide-m { display: none !important; }
  .only-m { display: flex; }
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .controls .btn.big { flex: 1 1 0; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 10; }
  .tabbar a { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 60px; text-decoration: none; color: #6B7889; font-size: 11px; font-weight: 500; position: relative; }
  .tabbar a.on { color: var(--navy); font-weight: 700; }
  .tabbar a.on::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
}
