/* style.css */
:root{
  --bg:#0b0f19;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:#22304a;
  --accent:#22c55e;
  --danger:#ef4444;
  --shadow: 0 10px 40px rgba(0,0,0,.45);
  --r:16px;
  --pad:14px;
  --font: ui-sans-serif, system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:var(--font);
  background: radial-gradient(1000px 700px at 10% -10%, rgba(34,197,94,.12), transparent 60%),
              radial-gradient(800px 600px at 110% 0%, rgba(59,130,246,.10), transparent 55%),
              var(--bg);
  color:var(--text);
}
.topbar{
  position:sticky; top:0; z-index:50;
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 14px;
  background: rgba(11,15,25,.88);
  backdrop-filter: blur(10px);
  border-bottom:1px solid rgba(34,48,74,.65);
}
.brand{display:flex; align-items:center; gap:12px}
.logo{
  width:40px; height:40px; border-radius:12px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, rgba(34,197,94,.9), rgba(59,130,246,.7));
  font-weight:900;
}
.titles{line-height:1.1}
.appname{font-weight:800}
.subtitle{font-size:12px; color:var(--muted)}
.wrap{max-width:980px; margin:0 auto; padding:16px 14px 40px}
.card{
  background: linear-gradient(180deg, rgba(17,24,39,.9), rgba(15,23,42,.92));
  border:1px solid rgba(34,48,74,.7);
  border-radius:var(--r);
  box-shadow: var(--shadow);
  padding: var(--pad);
}
.row{display:flex; gap:10px; align-items:end}
.grow{flex:1}
.field{display:flex; flex-direction:column; gap:6px; margin:8px 0}
label{font-size:12px; color:var(--muted)}
input,select{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid rgba(34,48,74,.9);
  background: rgba(2,6,23,.35);
  color: var(--text);
  outline:none;
}
input:focus,select:focus{border-color: rgba(34,197,94,.75); box-shadow: 0 0 0 4px rgba(34,197,94,.14)}
.hint{font-size:12px; color:var(--muted); margin-top:4px}
.btn{
  padding:12px 14px;
  border-radius:14px;
  border:1px solid rgba(34,48,74,.9);
  background: rgba(34,197,94,.18);
  color: var(--text);
  font-weight:800;
  cursor:pointer;
}
.btn:active{transform: translateY(1px)}
.btn.ghost{background: rgba(2,6,23,.25)}
.btn.danger{background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.45)}
.btn.danger.ghost{background: rgba(2,6,23,.25); border-color: rgba(239,68,68,.45)}
.iconbtn{
  position:relative;
  width:44px; height:44px;
  border-radius:14px;
  border:1px solid rgba(34,48,74,.8);
  background: rgba(2,6,23,.25);
  color: var(--text);
  cursor:pointer;
}
.dot{
  position:absolute;
  top:8px; right:8px;
  width:10px; height:10px; border-radius:999px;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(34,197,94,.18);
}
.kpis{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:10px;
  margin-top:10px;
}
.kpi{
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(34,48,74,.7);
  background: rgba(2,6,23,.25);
}
.kpi.accent{border-color: rgba(34,197,94,.6); background: rgba(34,197,94,.12)}
.kpiLabel{font-size:12px; color:var(--muted)}
.kpiValue{font-size:18px; font-weight:900; margin-top:6px}
.tabs{display:flex; gap:10px; margin:14px 0}
.tab{
  flex:1;
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(34,48,74,.8);
  background: rgba(2,6,23,.22);
  color: var(--text);
  font-weight:800;
  cursor:pointer;
}
.tab.active{background: rgba(34,197,94,.16); border-color: rgba(34,197,94,.55)}
.grid{display:grid; gap:14px}
.panel h2{margin:4px 0 10px; font-size:16px}
.actions{display:flex; gap:10px; margin-top:10px}
.mini{margin-top:12px}
.miniTitle{font-size:12px; color:var(--muted); margin-bottom:6px}
.miniList{display:flex; flex-direction:column; gap:8px}
.item{
  border:1px solid rgba(34,48,74,.7);
  background: rgba(2,6,23,.25);
  border-radius:14px;
  padding:10px;
}
.itemTop{display:flex; justify-content:space-between; gap:10px}
.itemTitle{font-weight:800; font-size:13px}
.itemMeta{font-size:12px; color:var(--muted); margin-top:4px}
.split{display:grid; grid-template-columns: 1fr; gap:12px}
@media (min-width: 900px){ .split{grid-template-columns: 1fr 1fr;} }
.box{
  border:1px solid rgba(34,48,74,.7);
  background: rgba(2,6,23,.20);
  border-radius:14px;
  padding:12px;
}
.boxTitle{font-weight:900; margin-bottom:10px}
.table{overflow:auto}
.table table{width:100%; border-collapse:collapse; font-size:13px}
.table th,.table td{padding:10px 8px; border-bottom:1px solid rgba(34,48,74,.6); white-space:nowrap}
.table th{color:var(--muted); font-weight:800; text-align:left}
.table td.num{text-align:right}

/* ✅ dialog modal (iOS安定) */
dialog.modal{
  border:none;
  padding:0;
  background: transparent;
}
dialog.modal::backdrop{
  background: rgba(0,0,0,.55);
}
.modalCard{
  width:min(560px, 100%);
  border-radius:18px;
  border:1px solid rgba(34,48,74,.85);
  background: linear-gradient(180deg, rgba(17,24,39,.98), rgba(15,23,42,.98));
  box-shadow: var(--shadow);
  padding:14px;
}
.modalHead{display:flex; justify-content:space-between; align-items:center; margin-bottom:8px}
.modalTitle{font-weight:900}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform: translateX(-50%);
  max-width:min(640px, calc(100% - 28px));
  padding:12px 14px;
  border-radius:16px;
  border:1px solid rgba(34,48,74,.85);
  background: rgba(2,6,23,.72);
  color: var(--text);
  box-shadow: var(--shadow);
  z-index:200;
}